Cue
I want to instanciate incoming data using useFetch(), should I use transform or onResponse()?
IMO I’d be explicit and create an index.ts in that directory and export the necessary classes, this way you’re not only managing your classes in one place, but not having to declare them in a plugin. You’d then do a wildcard import, where all classes are now effectively a map.
While it is still a declarative way of addressing your issue, it’s much more controlled so you’re not relying on hacky logic to determine what should and shouldn’t be passed to the payload handlers.
24 replies
I want to instanciate incoming data using useFetch(), should I use transform or onResponse()?
But this depends on how you're defining your classes. For example, are the classes named exports? Are there other exports within these files? Can you extract these easily?
24 replies
I want to instanciate incoming data using useFetch(), should I use transform or onResponse()?
You can do, but you'd be better off doing so with a module where you can traverse your directory and extract classes into a virtual module, and define a plugin within the module to execute the above logic.
24 replies
Dark mode with neutral color seems to be broken in the UI docs
Create and report the issue here https://github.com/nuxt/ui/issues
6 replies
Breaking app when awaiting composable in page setup
The issue arising here is that you’re wrapping useFetch in a promise, and awaiting that promise, when it is expected that the promise returned from useFetch is to be resolved in setup/plugins/middleware.
14 replies
How to handle 404 from the `_nuxt` folder?
Check your cache headers, or consider setting them, particularly via
routeRules
. For me, I usually cache nuxt dependencies for a day, public assets for a year (these are versioned anyway), so on. YMMV depending on how frequently you deploy. Work around your deployment schedule.3 replies