question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onResponseError element-plus el-notification bug

See original GitHub issue

Environment


  • 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:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
arnauddoubcommented, Jul 6, 2022

If people are interested, with this code I can have the notifications and the user in async in the layout stackblitz

0reactions
danielroecommented, Jul 4, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found