nuxt / nuxt/nuxt

🐞 Updating app config from server plugin isn't get carried to client app

Open
#21,630 4 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🍰 p2-nice-to-have good first issue
Dominant language
TypeScript
Stars
60.9k
Forks
5.8k
Avg merge
7h 8m
Merged PRs (30d)
162

Description

Environment
  • Operating System: Darwin
  • Node Version: v18.15.0
  • Nuxt Version: 3.5.2
  • Nitro Version: 2.4.1
  • Package Manager: pnpm@8.5.1
  • Builder: vite
  • User Config: app, appConfig, typescript, build, devtools, vite
  • Runtime Modules: -
  • Build Modules: -
Reproduction

https://stackblitz.com/edit/github-fwi5t5

Describe the bug

Hi 👋🏻

I've very special requirement and for that I have to update the appConfig (e.g. theme) from server (I choose plugin for this work) based on visited URL (I'll be serving same nuxt app to multiple subpaths for demo purposes using nginx).

When I try to set the appConfig from the server plugin it updates it but as soon we reach to the client app appConfig gt reset 🤔 . For example if set theme to dark using server plugin then I dont get dark on the client side.

Additional context

More context on what I'm doing. We building admin templates and we are adding nuxt support. We display 6 demos for our template and each has different subpath based on demo number (/vuexy-vuejs-admin-template/demo-1,2,3,4,5,6). We can't run 6 instances of nuxt/node app and trying to server single nuxt app via nginx when these six URL is visited.

If you have any advice on achieving above scenario let me know, I'm still exploring.

Logs

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked StackBlitz reproduction and inspect how the server plugin sets appConfig before the client app starts. Compare the appConfig value on the server and client for a URL-based theme; done means the server-selected value remains available after client startup.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, nuxtjs, typescript
Domain
full-stack, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.