Compare commits

...

1 Commits

Author SHA1 Message Date
Rick Hanlon
fff1baa904 Failing test for effect unmount issue 2023-03-31 21:52:10 -04:00
3 changed files with 60 additions and 0 deletions

View File

@@ -358,6 +358,11 @@ function safelyCallDestroy(
nearestMountedAncestor: Fiber | null,
destroy: () => void,
) {
if (destroy.CALLED) {
throw new Error('CALLED');
}
destroy.CALLED = true;
try {
destroy();
} catch (error) {

View File

@@ -1863,6 +1863,9 @@ function pushEffect(
destroy: (() => void) | void,
deps: Array<mixed> | void | null,
): Effect {
if (destroy && destroy.CALLED) {
throw new Error('CALLED ' + destroy.NAME);
}
const effect: Effect = {
tag,
create,

View File

@@ -445,5 +445,57 @@ Random seed is ${SEED}
</React.Suspense>,
);
});
it('6', async () => {
const {Text, Container, testResolvedOutput} = createFuzzer();
try {
await testResolvedOutput(
<React.Fragment>
<Text
initialDelay={0}
text="A"
updates={[
{
beginAfter: 0,
suspendFor: 1,
},
]}
/>
<Container
name="X"
updates={[
{
remountAfter: 0,
},
{
remountAfter: 0,
},
]}>
<Container
name="Y"
updates={[
{
remountAfter: 0,
},
]}>
<Text
initialDelay={0}
text="B"
updates={[
{
beginAfter: 0,
suspendFor: 1,
},
]}
/>
</Container>
</Container>
</React.Fragment>,
);
} catch (e) {
console.log(Scheduler.unstable_clearLog());
throw e;
}
});
});
});