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(ref): preserve ref on components after removing root element (#6632, #6641) #6718

Merged
merged 1 commit into from
Oct 3, 2017
Merged

fix(ref): preserve ref on components after removing root element (#6632, #6641) #6718

merged 1 commit into from
Oct 3, 2017

Conversation

javoski
Copy link
Member

@javoski javoski commented Sep 29, 2017

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

Other information:
fix #6632 & #6641 .

@TomKaltz
Copy link

TomKaltz commented Oct 3, 2017

+1

@nemtsov
Copy link

nemtsov commented Apr 20, 2018

Just a heads up that this turned out to break our tests. Not a big deal, but just wanted to let you know. Here's what our code & tests looked like:

// Parent
<template>
  <div>
    <Child ref="child" />
  </div>
</template>

// Child
<template>
  <div v-if="$store.state.isOn">yes</div>
</template>


// test
expect(this.vm.$refs.child).toExist();

this.vm.$store.state.isOn = false;
await this.vm.$nextTick();

expect(this.vm.$refs.child).not.toExist();

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.

Vue will remove unused node and set the refs to undefined
4 participants