-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add load and error events for server compoments #25744
Comments
I don't think we should rely on How about exposing a |
I didn't know Is there a good reason not to use |
My personal opinion is that that kind of event should be limited to a vue application or at a component level and not to the whole document context. You'd also have to remove the listener when the component is unmounted or you'll have a memory leak. If you want to use events, we can use @danielroe any thoughts ? |
I am using something like this at work https://stackblitz.com/~/github.com/marccremer/nuxt_islands_issue/tree/loading_island_events I want to keep the event driven messaging. |
What I mean is that this loading state is only related to a single component instance -> the island. And each island have their own loading state. We do have hooks on nuxt, yet I don't think this is a good idea to allow islands to use hooks, especially for loading state. This isn't like the nuxt loading indicator which is something more global in the nuxt application context. I think we should start with by exposing a loading state |
Describe the feature
At the moment there is no real way to display a loading state while a server component is getting fetched.
We basically have 2 options.
Both of these solutions have issues.
I suggest we add an event on
document
and let the user do something likeI made a small patch as PoC https://github.com/marccremer/nuxt_islands_issue/blob/loading_island_events/.yarn/patches/nuxt-npm-3.10.0-f38f448dd9.patch
I am looking for feedback on the shape of the event and location in the life cycle.
Additionally I think we should add an error event later on
Additional information
Final checks
The text was updated successfully, but these errors were encountered: