Skip to content

perf(nuxt): use reducer array and avoid crashing if prototype is modified#28768

Merged
danielroe merged 2 commits into
mainfrom
fix/devalue
Sep 2, 2024
Merged

perf(nuxt): use reducer array and avoid crashing if prototype is modified#28768
danielroe merged 2 commits into
mainfrom
fix/devalue

Conversation

@danielroe

@danielroe danielroe commented Aug 30, 2024

Copy link
Copy Markdown
Member

🔗 Linked issue

resolves #28769

📚 Description

devalue iterates over all properties (including prototype properties) of reducers passed to it (see sveltejs/devalue#80). There may possibly be some valid use cases where users modify an object prototype, and this PR ensures that a Nuxt server won't crash in this case.

Regardless, for clarity, I would advise against mutating prototypes - plenty of other things may well crash in this case, without it being a bug or issue.

thanks to @lirantal for the original issue and working through this with me ❤️

@danielroe danielroe added 3.x 🐛 bug Something isn't working as expected 🍰 p2-nice-to-have Nice to have, not blocking ⚡ performance Performance degradation or optimization opportunity labels Aug 30, 2024
@danielroe danielroe requested a review from pi0 August 30, 2024 14:44
@danielroe danielroe self-assigned this Aug 30, 2024
@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@lirantal

Copy link
Copy Markdown
Contributor

Thanks for working through all the examples and code reproduction code with me Daniel ❤️❤️❤️

Comment thread packages/nuxt/src/core/runtime/nitro/dev-server-logs.ts
@danielroe danielroe merged commit 125dae6 into main Sep 2, 2024
@danielroe danielroe deleted the fix/devalue branch September 2, 2024 11:14
@github-actions github-actions Bot mentioned this pull request Sep 2, 2024
@github-actions github-actions Bot mentioned this pull request Sep 3, 2024
Kamsou pushed a commit to Kamsou/nuxt that referenced this pull request Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.x 🐛 bug Something isn't working as expected 🍰 p2-nice-to-have Nice to have, not blocking ⚡ performance Performance degradation or optimization opportunity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nuxt crashes due to changes in the Object prototype chain

3 participants