Skip to content

useFetch triggers a request on the client side in nested components (using resolveComponent) #20476

Closed

Description

Environment


  • Operating System: Linux
  • Node Version: v18.12.1
  • Nuxt Version: 3.4.2
  • Nitro Version: 2.3.3
  • Package Manager: npm@8.19.2
  • Builder: vite
  • User Config: components
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/nuxt-starter-6ejkfx?file=pages/variable.vue

Describe the bug

This issue happens when you use nested <component :is="component" />

If you resolve the parent component with the string - useFetch triggers a request only on the server side and the data is transferred to the client, which is fine.

const component = resolveComponent('Main');

If you resolve the parent component with the variable, everything renders well, but useFech triggers a request both on the server side and the client side

const name = 'Main';
const component = resolveComponent(name);

Components are registered as global components as it was mentioned here.

Additional context

There is an index.vue page in the stackblitz example where everything works fine, and variable.vue which is "broken".

Logs

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions