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

Transition not triggering @appear when used as the root of a component with appear attr #9364

Closed
badz0 opened this issue Jan 24, 2019 · 3 comments

Comments

@badz0
Copy link

badz0 commented Jan 24, 2019

Version

2.5.22

Reproduction link

https://codepen.io/bogdan-muranets/pen/ErjOXy

Steps to reproduce

Open repro, click on the "show" button and note that "animated on enter" text appeared.

What is expected?

To see a text "animated on appear" which has to be added by @appear hook.

What is actually happening?

The @enter hook is called instead of @appear.


Important is that transition is moved to separate component. Also, everything works as expected if transition isn't a root element in a separate component or the component is functional.

@posva posva added the bug label Jan 24, 2019
@posva posva changed the title Transition ignores "appear" attribute Transition ignores "appear" attribute when used as the root of a component Jan 24, 2019
@posva posva changed the title Transition ignores "appear" attribute when used as the root of a component Transition not triggering @appear when used as the root of a component with appear attr Jan 24, 2019
@Itisfilipe
Copy link

Consider this snippet (and comment)

// activeInstance will always be the <transition> component managing this
// transition. One edge case to check is when the <transition> is placed
// as the root node of a child component. In that case we need to check
// <transition>'s parent for appear check.
let context = activeInstance
let transitionNode = activeInstance.$vnode
while (transitionNode && transitionNode.parent) {
transitionNode = transitionNode.parent
context = transitionNode.context
}
const isAppear = !context._isMounted || !vnode.isRootInsert

Also, from the docs "If you also want to apply a transition on the initial render of a node".

Since the appear is placed as Root of the element the transaction will consider the parent element and since it is already rendered the appear hook will be skiped.

@posva
Copy link
Member

posva commented Jan 25, 2019

From my perspective, the behaviour is not consistent as the appear does trigger if the transition element is wrapped with a different element like a div

@yyx990803
Copy link
Member

closed via #9668

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

4 participants