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

Having a v-if on component of which value changes on mounted, returns TypeError. #9189

Closed
matthijs88 opened this issue Apr 24, 2021 · 1 comment

Comments

@matthijs88
Copy link

Versions

  • nuxt: v2.15.4
  • node: 15.1.0

A TypeError occurs when a variable that is changed on mounted() is linked to a v-if of a component.

Reproduction

The following code returns an error in the browser.
~/pages/bar.vue

<template>
  <div>
    <Foo v-if="loading" />
  </div>
</template>
<script>
export default {
  data() {
    return {
      loading: true
    }
  },
  mounted() {
    this.loading = false
  }
}
</script>

~/components/Foo.vue

<template>
  <div>Loading</div>
</template>

Error in browser:

TypeError: Cannot read property 'resolved' of undefined
    at patchVnode (vue.runtime.esm.js?2b0e:6284)
    at updateChildren (vue.runtime.esm.js?2b0e:6193)
    at patchVnode (vue.runtime.esm.js?2b0e:6319)
    at VueComponent.patch [as __patch__] (vue.runtime.esm.js?2b0e:6482)
    at VueComponent.Vue._update (vue.runtime.esm.js?2b0e:3948)
    at VueComponent.updateComponent (vue.runtime.esm.js?2b0e:4060)
    at Watcher.get (vue.runtime.esm.js?2b0e:4479)
    at Watcher.run (vue.runtime.esm.js?2b0e:4554)
    at flushSchedulerQueue (vue.runtime.esm.js?2b0e:4310)
    at Array.eval (vue.runtime.esm.js?2b0e:1980)

This error doesn't occur when the v-if="loading" is applied to a div.

Applying a timeout of 2000ms before running this.loading = false in mounted did not solve the problem.

@stale
Copy link

stale bot commented Jul 8, 2021

Thanks for your contribution to Nuxt!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of nuxt-edge
  2. Comment the steps to reproduce it

Issues that are labeled as pending will not be automatically marked as stale.

@stale stale bot added the stale label Jul 8, 2021
@stale stale bot closed this as completed Jul 21, 2021
@danielroe danielroe added the 2.x label Jan 18, 2023
@danielroe danielroe mentioned this issue Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants