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(runtime-core): Fix cssvars reporting error when teleport is disabled #7341

Merged
merged 27 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2e776d7
fix(runtime-core): Fix cssvars reporting error when teleport is disabled
baiwusanyu-c Dec 14, 2022
d4ad4b6
fix(runtime-core): update code
baiwusanyu-c Dec 14, 2022
d4d2478
Update Teleport.ts
baiwusanyu-c Dec 14, 2022
78121e7
Update Teleport.ts
baiwusanyu-c Dec 14, 2022
be01bf2
Merge branch 'vuejs:main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c Dec 26, 2022
45fbe10
Merge branch 'vuejs:main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c Jan 2, 2023
eed96e1
Merge branch 'vuejs:main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c Jan 9, 2023
33a3bc8
Merge branch 'vuejs:main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c Jan 13, 2023
b03fe36
Merge remote-tracking branch 'origin/main' into bwsy/fix/errorTelepor…
baiwusanyu-c Feb 4, 2023
2f775cf
Merge branch 'vuejs:main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c Feb 6, 2023
f802298
Merge branch 'main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c Feb 14, 2023
8ac55da
Merge branch 'main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c Feb 21, 2023
cb7a114
Merge branch 'main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c Feb 22, 2023
ff8a4e3
Merge branch 'main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c Mar 17, 2023
a553a23
Merge branch 'main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c Mar 20, 2023
8b80620
Merge branch 'main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c Mar 23, 2023
c8c63ff
Merge branch 'main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c Mar 27, 2023
3158f7f
Merge branch 'main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c Apr 6, 2023
4e71439
Merge branch 'main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c Apr 10, 2023
b0d9a0e
Merge branch 'main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c Apr 11, 2023
af720ea
Merge branch 'main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c Apr 14, 2023
2a74f59
Merge branch 'main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c Apr 17, 2023
50606df
Merge branch 'main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c Apr 19, 2023
9e6dab7
Merge branch 'main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c Apr 20, 2023
5793427
Merge branch 'main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c May 4, 2023
c67d2ca
Merge branch 'main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c May 16, 2023
c9ae8ee
Merge branch 'main' into bwsy/fix/errorTeleportCSSVars
baiwusanyu-c Aug 30, 2023
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
2 changes: 1 addition & 1 deletion packages/runtime-core/src/components/Teleport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ function updateCssVars(vnode: VNode) {
const ctx = vnode.ctx
if (ctx && ctx.ut) {
let node = (vnode.children as VNode[])[0].el!
while (node !== vnode.targetAnchor) {
while (node && node !== vnode.targetAnchor) {
if (node.nodeType === 1) node.setAttribute('data-v-owner', ctx.uid)
node = node.nextSibling
}
Expand Down
18 changes: 18 additions & 0 deletions packages/runtime-dom/__tests__/helpers/useCssVars.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,4 +275,22 @@ describe('useCssVars', () => {
expect((c as HTMLElement).style.getPropertyValue(`--color`)).toBe('red')
}
})

test('with teleport(disabled)', async () => {
document.body.innerHTML = ''
const state = reactive({ color: 'red' })
const root = document.createElement('div')
const target = document.body

const App = {
setup() {
useCssVars(() => state)
return () => [h(Teleport, { to: target, disabled: true }, [h('div')])]
}
}

expect(() => render(h(App), root)).not.toThrow(TypeError)
await nextTick()
expect(target.children.length).toBe(0)
})
})
Loading