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

fix(nuxt): use undefined rather than null for data fetching defaults #27294

Merged
merged 12 commits into from
May 21, 2024

Conversation

danielroe
Copy link
Member

@danielroe danielroe commented May 21, 2024

🔗 Linked issue

resolves #26295

📚 Description

This updates the default value for error + data in useFetch and useAsyncData, as well as in useError(). It updates both the types and the runtime value in a backwards compatible way, so future.compatibilityVersion: 4 is respected.

One note: previously the default value of useAsyncData was inconsistent. It was initialised to null but cleared in clearNuxtData to undefined. This PR preserves the inconsistency for v3 compatibility mode.

Copy link

stackblitz bot commented May 21, 2024

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

@github-actions github-actions bot added the 3.x label May 21, 2024
@pi0
Copy link
Member

pi0 commented May 21, 2024

undefined forever 🚀

@danielroe danielroe merged commit 8a759bc into main May 21, 2024
62 checks passed
@danielroe danielroe deleted the fix/undefined-default-value branch May 21, 2024 22:58
This was referenced May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Settle on either undefined or null for async data's data and error
3 participants