Skip to content

fix(runtime-dom): transitionGroup can render :slotted styles #7541

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

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0692ea7
fix(transitionGroup): `transitionGroup` can render `:slotted` styles
baiwusanyu-c Jan 16, 2023
e49ecec
fix(runtime-dom): added unit test
baiwusanyu-c Jan 16, 2023
5ed4e9f
Merge branch 'vuejs:main' into bwsy/fix/slotted
baiwusanyu-c Jan 18, 2023
68d0552
Merge remote-tracking branch 'origin/main' into bwsy/fix/slotted
baiwusanyu-c Feb 4, 2023
52c0595
Merge branch 'vuejs:main' into bwsy/fix/slotted
baiwusanyu-c Feb 6, 2023
9df9530
Merge branch 'main' into bwsy/fix/slotted
baiwusanyu-c Feb 14, 2023
a01bf5f
Merge branch 'main' into bwsy/fix/slotted
baiwusanyu-c Feb 21, 2023
497acb7
Merge branch 'main' into bwsy/fix/slotted
baiwusanyu-c Feb 22, 2023
1e9f450
Merge branch 'main' into bwsy/fix/slotted
baiwusanyu-c Mar 17, 2023
697da63
Merge branch 'main' into bwsy/fix/slotted
baiwusanyu-c Mar 20, 2023
39d2353
Merge branch 'main' into bwsy/fix/slotted
baiwusanyu-c Mar 23, 2023
c178536
Merge branch 'main' into bwsy/fix/slotted
baiwusanyu-c Mar 27, 2023
4a747a5
Merge branch 'main' into bwsy/fix/slotted
baiwusanyu-c Apr 6, 2023
d990d5a
Merge branch 'main' into bwsy/fix/slotted
baiwusanyu-c Apr 10, 2023
4bba69c
Merge branch 'main' into bwsy/fix/slotted
baiwusanyu-c Apr 12, 2023
821c825
Merge branch 'main' into bwsy/fix/slotted
baiwusanyu-c Apr 14, 2023
9107fec
Merge branch 'main' into bwsy/fix/slotted
baiwusanyu-c Apr 17, 2023
83a653e
Merge branch 'main' into bwsy/fix/slotted
baiwusanyu-c Apr 19, 2023
c8e445b
Merge branch 'main' into bwsy/fix/slotted
baiwusanyu-c Apr 20, 2023
663d0d4
Merge branch 'main' into bwsy/fix/slotted
baiwusanyu-c May 4, 2023
ff732fe
Merge branch 'main' into bwsy/fix/slotted
baiwusanyu-c May 16, 2023
2c52821
Merge branch 'main' into bwsy/fix/slotted
baiwusanyu-c May 17, 2023
7596447
Merge branch 'main' into bwsy/fix/slotted
baiwusanyu-c May 23, 2023
7664bc4
Merge branch 'main' into bwsy/fix/slotted
baiwusanyu-c May 29, 2023
f23cb52
Merge branch 'main' into bwsy/fix/slotted
baiwusanyu-c Jan 3, 2024
c8c783e
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 3, 2024
6bafa10
Merge remote-tracking branch 'upstream/main' into bwsy/fix/slotted
baiwusanyu-c Mar 27, 2024
9a5df2b
Merge branch 'main' into bwsy/fix/slotted
edison1105 Aug 20, 2024
beb6694
fix(runtime-dom): updated code
Aug 20, 2024
7ca6a18
fix(runtime-dom): delete comment
Aug 20, 2024
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
36 changes: 36 additions & 0 deletions packages/runtime-core/__tests__/scopeId.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
} from '@vue/runtime-test'
import { withCtx } from '../src/componentRenderContext'
import { PatchFlags } from '@vue/shared'
import { TransitionGroup } from '@vue/runtime-dom'

describe('scopeId runtime support', () => {
test('should attach scopeId', () => {
Expand Down Expand Up @@ -214,6 +215,41 @@ describe('scopeId runtime support', () => {
)
})

test(':slotted should work on transitionGroup', async () => {
const Child = {
__scopeId: 'child',
render(this: any) {
return h('div', renderSlot(this.$slots, 'default'))
},
}

const App = {
__scopeId: 'parent',
render: () => {
return h(
Child,
withCtx(() => {
return [
h(TransitionGroup, null, {
default: withCtx(() => [
h('div', { key: 'foo' }, ' I have a TransitionGroup '),
]),
}),
]
}),
)
},
}
const root = nodeOps.createElement('div')
render(h(App), root)
// slot content should have:
// - scopeId from parent
// - slotted scopeId (with `-s` postfix) from child (the tree owner)
expect(serializeInner(root)).toBe(
`<div child parent><div parent child-s> I have a TransitionGroup </div></div>`,
)
})

// #1988
test('should inherit scopeId through nested HOCs with inheritAttrs: false', () => {
const App = {
Expand Down
4 changes: 3 additions & 1 deletion packages/runtime-dom/src/components/TransitionGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ const TransitionGroupImpl: ComponentOptions = {
}
}

return createVNode(tag, null, children)
const node = createVNode(tag, null, children)
node.slotScopeIds = instance.vnode.slotScopeIds
return node
}
},
}
Expand Down