onResponseError element-plus el-notification bug
See original GitHub issueEnvironment
- Operating System:
Linux
- Node Version:
v16.14.2
- Nuxt Version:
3.0.0-rc.4
- Package Manager:
npm@7.17.0
- Builder:
vite
- User Config:
css
,build
- Runtime Modules:
-
- Build Modules:
-
Reproduction
https://stackblitz.com/edit/github-38hauf?file=composables/useApi.ts
Describe the bug
Hello, in the header I get a null user but if i comment ElNotification which is in onResponseError of useApi.ts i get my user in the header. I don’t understand why. (sorry for my English)
Additional context
dependency element-plus 2.2.6
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Notification - Element Plus
Element Plus provides four notification types: success , warning , info and error . They are set by the type field, and other...
Read more >[Component] [notification] nuxt 3 element-plus el ... - bytemeta
When i use el-notification in onResponseError on nuxt 3 i have error [Vue warn]: Hydration node mismatch: but if i remove el-notification i...
Read more >How to use the element-ui.Notification.error function in ... - Snyk
To help you get started, we've selected a few element-ui.Notification.error examples, based on popular ways it is used in public projects.
Read more >Element-plus & server side rendering - wrong hydration for ...
1. This is the way I fix this bug import { ID_INJECTION_KEY } from "element-plus"; import type { NuxtApp } from "nuxt3/app"; ...
Read more >element-plus - npm
A Component Library for Vue 3. Latest version: 2.2.27, last published: 9 days ago. Start using element-plus in your project by running `npm ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If people are interested, with this code I can have the notifications and the user in async in the layout stackblitz
This is a common SSR gotcha. The issue is that on SSR, Vue renders the HTML from top to bottom, outside to inside. And if you only fetch the user as you are rendering the ‘inner’ part of the page, it doesn’t rerender the layout at the top of the page. (On client-side it’s fine as can be reactive.) So if you have a common piece you rely on for rendering your page, make sure to fetch it in the layout, a plugin, or a middleware - somewhere outside of the rendering process.