Skip to content

refactor(runtime-core): remove-get-transition-key #10283

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions packages/runtime-core/src/components/BaseTransition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@ const BaseTransitionImpl: ComponentOptions = {
const instance = getCurrentInstance()!
const state = useTransitionState()

let prevTransitionKey: any

return () => {
const children =
slots.default && getTransitionRawChildren(slots.default(), true)
Expand Down Expand Up @@ -211,23 +209,11 @@ const BaseTransitionImpl: ComponentOptions = {
const oldChild = instance.subTree
const oldInnerChild = oldChild && getKeepAliveChild(oldChild)

let transitionKeyChanged = false
const { getTransitionKey } = innerChild.type as any
if (getTransitionKey) {
const key = getTransitionKey()
if (prevTransitionKey === undefined) {
prevTransitionKey = key
} else if (key !== prevTransitionKey) {
prevTransitionKey = key
transitionKeyChanged = true
}
}

// handle mode
if (
oldInnerChild &&
oldInnerChild.type !== Comment &&
(!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)
!isSameVNodeType(innerChild, oldInnerChild)
) {
const leavingHooks = resolveTransitionHooks(
oldInnerChild,
Expand Down