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): avoid destructuring error prop (works around upstream bug) #20795

Merged
merged 4 commits into from
May 11, 2023
Merged

fix(nuxt): avoid destructuring error prop (works around upstream bug) #20795

merged 4 commits into from
May 11, 2023

Conversation

Lehoczky
Copy link
Contributor

@Lehoczky Lehoczky commented May 11, 2023

πŸ”— Linked issue

Fixes #20789

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This regression is probably caused by the changes regarding the experimental prop destructuring in Vue 3.3, which might not cover the edge case where someone is using destructuring without enabling this new experimental feature, although I haven't look really deep into this.

Fortunately it seems like we can avoid this bug by using a props variable and destructuring it later. This way the error object should still lose it's reactivity but now the compiled output is valid.

How I tested:

In the playground I changed app.vue to:

<script setup lang="ts"></script>

<template>
  <div>
    <NuxtLayout>
      <NuxtPage />
    </NuxtLayout>
  </div>
</template>

<style scoped></style>

Added an index page in pages/index.vue:

<template>
  <div>asd</div>
</template>

And navigated to a random url, like /this-does-not-exist, to get to the error page. Without changes I was able to reproduce the error in the linked ticket, but after the changes it works fine.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@Lehoczky Lehoczky changed the title fix: error prop no longer undefined for Vue3.3 fix(error-page): error prop no longer undefined for Vue3.3 May 11, 2023
@Lehoczky
Copy link
Contributor Author

Lehoczky commented May 11, 2023

Also feel free to close this if we want to wait for an upstream fix, this is really just a fast band aid solution for nuxt.

Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect - thanks!

@danielroe danielroe changed the title fix(error-page): error prop no longer undefined for Vue3.3 fix(nuxt): avoid destructuring error prop (works around upstream bug) May 11, 2023
@danielroe danielroe merged commit 6b7197f into nuxt:main May 11, 2023
@github-actions github-actions bot mentioned this pull request May 11, 2023
@Lehoczky
Copy link
Contributor Author

@danielroe I created an upsteam issue: vuejs/core#8289

@github-actions github-actions bot mentioned this pull request May 16, 2023
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 this pull request may close these issues.

Default error page does not work on Windows
2 participants