Skip to content

Commit e974844

Browse files
committed
add another another failing test
1 parent 1a90dc6 commit e974844

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/client/tests/renderable.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,3 +605,33 @@ test('invalidating grandparent during child render triggers update', () => {
605605
invalidate(middle)
606606
assert_eq(el.innerHTML, 'loading')
607607
})
608+
609+
test('invalidating parent during child render when reusing renderable keeps child stale', () => {
610+
const { root, el } = setup()
611+
612+
const parent = {
613+
render() {
614+
return child
615+
},
616+
}
617+
618+
const child = {
619+
stage: 'initial',
620+
did_invalidate: false,
621+
622+
render() {
623+
const output = this.stage
624+
625+
if (!this.did_invalidate) {
626+
this.did_invalidate = true
627+
this.stage = 'updated'
628+
invalidate(parent)
629+
}
630+
631+
return output
632+
},
633+
}
634+
635+
root.render(parent)
636+
assert_eq(el.innerHTML, 'updated')
637+
})

0 commit comments

Comments
 (0)