mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
Failing test for effect unmount issue
This commit is contained in:
1 parent
1a1d61fed9
commit
fff1baa904
3 files changed
+60
No files matched your search
@@ -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) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user