Nuxt.js: Implementation of nuxtClientInit Action

Created on 22 Sep 2018  路  10Comments  路  Source: nuxt/nuxt.js

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

This feature request is available on Nuxt community (#c7801)
feature-request

Most helpful comment

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).

All 10 comments

Hey @potato4d!
Sure, fire up a PR for it and we'll look into it 鈽猴笍

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

Doing it now!

@potato4d Any update? 鈽猴笍

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

@potato4d Take your time and don't hesitate to ask for help if you get stuck 鈽猴笍

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

So what is the solution now?

@johanvanwambeke feel free to use https://github.com/potato4d/nuxt-client-init-module

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).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

surmon-china picture surmon-china  路  3Comments

msudgh picture msudgh  路  3Comments

shyamchandranmec picture shyamchandranmec  路  3Comments

vadimsg picture vadimsg  路  3Comments

mattdharmon picture mattdharmon  路  3Comments