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

Vuex Devtools plugins registered on server which increases memory usage #2250

Open
3 tasks done
urbnjamesmi1 opened this issue Jul 15, 2024 · 0 comments · May be fixed by #2251
Open
3 tasks done

Vuex Devtools plugins registered on server which increases memory usage #2250

urbnjamesmi1 opened this issue Jul 15, 2024 · 0 comments · May be fixed by #2251

Comments

@urbnjamesmi1
Copy link

Version

4.0.2

Describe the bug

Recently upgraded Vuex to 4.0.2 for a Vue 3 migration that uses a custom SSR solution using Express and Webpack. When running in development mode, the server's memory continued to rise with usage, whereas in production mode, it didn't happen.

Ran a profiler via Chrome's devtools and noticed that in development mode, there were large memory allocations for the VUE_DEVTOOLS_PLUGINS. We also use vue-i18n and vue-router which also register devtools plugins when running in development mode.

However, those other libraries make a check that they are executing in the browser or not in a Node environment, but Vuex does not. As long as you are running in development mode (even on the server) it registers the devtools plugins. I believe this is the cause of the sustained memory usage (possibly a leak?).

I will submit a PR to fix this issue.

Reproduction

  1. Use Vuex 4.0.2 with Vue 3 with SSR on a Node server process while running with NODE_ENV=development
  2. Make sure the usage includes registering store modules at runtime
  3. Notice that as the server processes more requests that use Vuex, the memory used by the server will rise and not come down.
  4. Notice that the same thing doesn't happen if you run the server with NODE_ENV=production

Expected behavior

Vuex not to add devtools on the server (even if NODE_ENV=development), client-side is fine.

Additional context

No response

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
urbnjamesmi1 added a commit to urbnjamesmi1/vuex that referenced this issue Jul 15, 2024
- Add check that code is running in a browser before adding devtools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant