Implementation of nuxtClientInit Action

potato4d
168
potato4d
commented a year ago

What problem does this feature solve?

Currently, Nuxt.js does not have a way to create actions to be done only on the client.
It is possible to implement it using plugins and middleware, but it will be implemented with a different interface from nuxtServerInit.

Also, in SPA mode there is no equivalent of nuxtServerInit.

In order to solve this problem, I would like to add nuxtServerInit for clients.

What does the proposed changes look like?

I implemented it as a module of Nuxt.js. However, I want Nuxt.js core to have nuxtClientInit.

https://github.com/potato4d/nuxt-client-init-module


Although it was written that it is advancing the implementation before, is there any plan to implement it?

If possible, I would like to collaborate on implementation.

https://github.com/nuxt/nuxt.js/issues/1857#issuecomment-336874401

idea
1
manniL
6.9k
manniL
commented a year ago

Hey @potato4d!
Sure, fire up a PR for it and we'll look into it ☺️

0
potato4d
168
potato4d
commented a year ago

Doing it now!

0
manniL
6.9k
manniL
commented a year ago

@potato4d Any update? ☺️

0
potato4d
168
potato4d
commented a year ago

@manniL
I am trying hard but I am a bit struggling.
The goal is to submit a pull request next week!

0
manniL
6.9k
manniL
commented a year ago

@potato4d Take your time and don't hesitate to ask for help if you get stuck ☺️

0
manniL
6.9k
manniL
commented a year ago

Closing this in favor of the linked PR, (possibly) upcoming RFC and further updates.

0
johanvanwambeke
0
johanvanwambeke
commented 6 months ago

So what is the solution now?

0
sebmor
0
sebmor
commented 5 months ago

I really would like to see this as a core functionality of Nuxt.
Imo the most elegant solution would be something like nuxtInit (or storeInit or something) that is run on either client or server depending on universal/spa mode. (but it would not run twice).

0
Informations
Feature RequestOpen
#c7801 - Created a year ago