Skip to content

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

Merged
yyx990803 merged 1 commit into
vuejs:devfrom
javoski:ref-quick-fix
Oct 3, 2017
Merged

fix(ref): preserve ref on components after removing root element (#6632, #6641)#6718
yyx990803 merged 1 commit into
vuejs:devfrom
javoski:ref-quick-fix

Conversation

@javoski

@javoski javoski commented Sep 29, 2017

Copy link
Copy Markdown
Member

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

TomKaltz commented Oct 3, 2017

Copy link
Copy Markdown

+1

@nemtsov

nemtsov commented Apr 20, 2018

Copy link
Copy Markdown

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