Skip to content

Commit 17c7e1e

Browse files
authored
Prepare placeholders before timing out (#13092)
* Prepare placeholders before timing out While a tree is suspended, prepare for the timeout by pre-rendering the placeholder state. This simplifies the implementation a bit because every render now results in a completed tree. * Suspend inside an already timed out Placeholder A component should be able to suspend inside an already timed out placeholder. The time at which the placeholder committed is used as the start time for a subsequent suspend. So, if a placeholder times out after 3 seconds, and an inner placeholder has a threshold of 2 seconds, the inner placeholder will not time out until 5 seconds total have elapsed.
1 parent 39b18f3 commit 17c7e1e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/ReactTestHostConfig.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export type PublicInstance = Instance | TextInstance;
3232
export type HostContext = Object;
3333
export type UpdatePayload = Object;
3434
export type ChildSet = void; // Unused
35+
export type TimeoutHandle = TimeoutID;
36+
export type NoTimeout = -1;
3537

3638
export * from 'shared/HostConfigWithNoPersistence';
3739
export * from 'shared/HostConfigWithNoHydration';
@@ -187,6 +189,10 @@ export const scheduleDeferredCallback =
187189
export const cancelDeferredCallback =
188190
TestRendererScheduling.cancelDeferredCallback;
189191

192+
export const scheduleTimeout = setTimeout;
193+
export const cancelTimeout = clearTimeout;
194+
export const noTimeout = -1;
195+
190196
// -------------------
191197
// Mutation
192198
// -------------------

0 commit comments

Comments
 (0)