Skip to content
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

asyncScripts _breaks_ nuxtServerInit #27459

Closed
hacknug opened this issue Jun 5, 2024 · 4 comments
Closed

asyncScripts _breaks_ nuxtServerInit #27459

hacknug opened this issue Jun 5, 2024 · 4 comments

Comments

@hacknug
Copy link
Contributor

hacknug commented Jun 5, 2024

Environment

System:
OS: Linux 6.1 Ubuntu 20.04.6 LTS (Focal Fossa)
CPU: (2) x64 AMD EPYC
Memory: 2.00 GB / 4.01 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 20.12.1 - /home/codespace/nvm/current/bin/node
Yarn: 1.22.19 - /usr/bin/yarn
npm: 10.5.0 - /home/codespace/nvm/current/bin/npm
pnpm: 8.15.6 - /home/codespace/nvm/current/bin/pnpm
npmPackages:
nuxt: 2.17.3 => 2.17.3

Reproduction

Describe the bug

When enabling render.asyncScripts to improve performance, it seems that sometimes the page/component code can run before nuxtServerInit (race condition I guess).

Not sure there is anything that can be easily done to ensure the store code always runs first.

Additional context

EOL is less than 30 days away so I'm pretty sure everyone will appreciate this issue being open 😃

If this is not something that can be easily fixed, I think it is okay to just leave a mention on both sides the docs (asyncScripts and nuxtServerInit).

Logs

No response

Copy link
Member

Thank you for raising this - and you're right that it's unlikely we can resolve this in the time frame... It also might not be soluble at all, as you indicate.

If you are able to investigate and submit a PR, either in code or docs, that would certainly be welcome.

@daniluk4000
Copy link
Contributor

As a workaround you can probably rename nuxtServerInit to any name and call it in plugin with process.server validation. As I can remember it should work great.

@danielroe
Copy link
Member

We are approaching the Nuxt 2 EOL date (June 30, 2024) - see this article for more information. This is advance warning that I'm going to close this issue then, as it's currently marked as a Nuxt 2 related bug.

If it's a critical or security issue, please do comment and let me know, in case it is possible to address it before the EOL date.

If it's a an issue you think is relevant for Nuxt 3, please feel free to open a fresh issue (or just comment here so I can update labels, etc.). 🙏

Thank you for your understanding and for your contribution to Nuxt. ❤️

@danielroe
Copy link
Member

It's the day, at last. Nuxt 2 is now marked end-of-life.

My apologies we never got round to resolving this bug in the 2.x branch, but we do have to draw a line somewhere. Again, if you think this is still relevant for Nuxt going forward, please feel free to open a fresh issue (or just comment here so I can update labels, etc.). 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants