Comments (5)
Basically, any thrown error inside defineRenderHandler
leads to this.
from nuxt.
As I've struggled deep into the code, the problem is probably that we can't rerender our app if any error happened.
The only thing that could delay some component from rendering is onServerPrefetch
, but we can't wait inside of it forever since we can't know if remaining app has been rendered or not.
Solution could be is to listen for @resolve
hook for that, but this is currently impossible due to vuejs/core#8555 not merged.
Also solution could be to render app twice (don't use Nitro's error handler) and on second render pass all the payload and state to this second render, and that will also skip mounting any plugins twice there. But I don't know if it is possible to preserve context somehow for multiple renders.
UPD: probably possible to restore state using useSSRContext()
.
from nuxt.
Yes, that is the case (and intentional). To render an error page, we render the app a second time, but just the error page and not app.vue
.
Plugins might do more things than set payload/state, such as inject helper functions. So we do need to rerun them. You can add your own logic to avoid rerunning logic. You can check in your plugins if useError().value
is set.
from nuxt.
Yes, that is the case (and intentional). To render an error page, we render the app a second time, but just the error page and not
app.vue
.Plugins might do more things than set payload/state, such as inject helper functions. So we do need to rerun them. You can add your own logic to avoid rerunning logic. You can check in your plugins if
useError().value
is set.
Yes I could, but sadly pinia context is lost as well :(
So I have to refetch for my data
from nuxt.
@danielroe do you think this worth trying to solve when @resolve
on Suspense will be supported on SSR? Basically, that's how it worked in Nuxt 2 (I know that there was totally different logic).
If at least state (including useState & pinia) would be passed to this reloaded context, it wouldn't be such a problem.
from nuxt.
Related Issues (20)
- How to mount nuxt app to the body tag without use the "__nuxt" id? HOT 3
- Uncaught SyntaxError: Unexpected token '<' at main.js HOT 3
- cloudflare_pages build error HOT 3
- Server Component Fallback not showing when lazy=true (On refresh) HOT 12
- Custom useCookie composable is not reactive between components HOT 2
- Hydration style mismatch: v-bind and style attribute on component root HOT 3
- Prerendering fails if file-based routing is disabled, but there are .vue files in pages directory HOT 9
- useNuxtApp provide type HOT 2
- Nuxt prepare error after installing sass, pinia and vitest with yarn in Nuxt 3.10.0 HOT 1
- Improve Nuxt Module Author Guide
- Problem with `useRuntimeConfig` and `useCookie` in `useCustomFetch` HOT 1
- useId bug when inheritAttrs: false
- Property X does not exist on type '{}'. - TypeScript HOT 9
- nuxt.js3 How to use qrcodejs2-fix; keeps reporting errors document is not defined HOT 2
- Feature: support style config on addComponent & addComponentsDir HOT 2
- Performance degradation when using many routes in comparison to Nuxt 2 HOT 6
- Warning for `NuxtPage` absence is always shown if `setPageLayout` is called in middleware HOT 6
- Change refs in error.vue
- Web Worker is not working when some external functions are used HOT 2
- useHead not works with routeRoules ssr false HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuxt.