Tackleberry
How are custom fetches used on a large scale project?
No problem! I'm referring to the approach outlined in this and this message. The idea is to not call the nuxt-context-dependent functions within the function handler itself, but rather define them in the setup part of your composable, where you are certain to have the necessary context. Then you can call them within your handlers.
Let's compare yours and mine. Yours:
to mine:
42 replies
How are custom fetches used on a large scale project?
have you tried supplying the nuxt app through your handler? If it works on refresh but not on page load I assume useNuxtApp() does not work on initial load because it's out of context (I assume because of some async shenanigans). So maybe try supplying the nuxt app via the handler function as it might have a nuxt app according to the type. So something like
and then check if nuxtApp is defined in your fetchAll and only try useNuxtApp if it isn't
42 replies
[Solved] Local Fonts Not Working
I notice you have a
srcDir: "src/"
set in your nuxt.config. If I interpret the docs correctly, the public directory is relative to the src directory by default. However, in your repo, the public folder is at top level and not inside the src directory. Maybe try moving the public folder inside the src directory.20 replies
How are custom fetches used on a large scale project?
why are you creating a function where you return the fetchAll call? And where is it called? Could you verify if this call triggers the warning? Because if this fetchAll function is called somewhere out of context, it might be the issue
42 replies
How are custom fetches used on a large scale project?
It's tricky without seeing any of your code, especially the way the plugin is implemented. A few things I could think of:
- Why does the composable require access to the Nuxt instance in the first place?
- Why does the composable need a separate plugin? Why not have the fetch in the composable?
- Can you verify when / where the functionality is called? Is it actually within the lifecycle of the page / component
- is the functionality used somewhere outside of your components (e.g. server side routes)?
42 replies