-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
fix(nuxt): ensure legacy async data remains reactive #32134
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
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses an issue where legacy asyncData values were frozen by ensuring they remain reactive by wrapping each property in computed getters and setters.
- Updated asyncData handling in component.ts to wrap properties in computed getters/setters.
- Added a new test in composables.test.ts to verify that calling refreshNuxtData properly updates the rendered output.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
test/nuxt/composables.test.ts | Added a test case to validate reactive updates via refreshNuxtData for Options API asyncData. |
packages/nuxt/src/app/composables/component.ts | Modified asyncData processing to expose properties as computed values ensuring reactivity. |
WalkthroughThe changes update the internal logic of the runLegacyAsyncData function in the Nuxt composable, replacing the use of Vue's reactive and toRefs with computed properties for each key in data.value. This adjustment alters how asyncData results are proxied, now using explicit computed getters and setters for reactivity. Additionally, a new test case was added to verify that asyncData remains reactive and updates correctly when refreshNuxtData is called in a component using the Options API. No changes were made to exported or public entity signatures. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
⏰ Context from checks skipped due to timeout of 90000ms (3)
🔇 Additional comments (3)
✨ Finishing Touches
🧪 Generate Unit Tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@nuxt/kit
nuxt
@nuxt/schema
@nuxt/rspack-builder
@nuxt/vite-builder
@nuxt/webpack-builder
commit: |
CodSpeed Performance ReportMerging #32134 will not alter performanceComparing Summary
|
🔗 Linked issue
resolves #29368
closes #29518
📚 Description
this ensures we don't 'freeze' the value in legacy asyncData but keep it reactive