Fix
Lint / lint (push) Failing after 42s

This commit is contained in:
Julien Valverdé
2026-07-23 04:13:27 +02:00
parent d8b9c0394c
commit 296f65ee1b
3 changed files with 54 additions and 2 deletions
@@ -374,6 +374,7 @@ describe("Component", () => {
React.use(pending)
return <div>committed</div>
}).pipe(
Component.withOptions({ scopeCommitTimeout: "10 millis" }),
Component.withContext(runtime.context)
)
@@ -414,7 +415,10 @@ describe("Component", () => {
return <div>committed</div>
}).pipe(
Component.withOptions({ finalizerExecutionDebounce: "10 millis" }),
Component.withOptions({
finalizerExecutionDebounce: "10 millis",
scopeCommitTimeout: "10 millis",
}),
Component.withContext(runtime.context),
)
@@ -437,6 +441,42 @@ describe("Component", () => {
await runtime.runtime.dispose()
})
it("does not expire a scope while a descendant is suspended past the finalizer debounce", async () => {
const runtime = ReactRuntime.make(Layer.empty)
let resolve!: () => void
const pending = new Promise<void>(complete => {
resolve = complete
})
const Suspended = () => {
React.use(pending)
return <div>committed</div>
}
let view!: ReturnType<typeof render>
await act(async () => {
view = render(
<ReactRuntime.Provider runtime={runtime} fallback={<div>fallback</div>}>
<Suspended />
</ReactRuntime.Provider>
)
})
try {
await screen.findByText("fallback")
await new Promise(resolve => setTimeout(resolve, 150))
await act(async () => {
resolve()
await pending
})
await screen.findByText("committed")
}
finally {
view.unmount()
await runtime.runtime.dispose()
}
})
it("clears ScopeRegistry after a suspended render retries, commits, and unmounts", async () => {
const lifecycle = vi.fn<(message: string) => void>()
const runtime = ReactRuntime.make(Layer.empty)
@@ -455,6 +495,7 @@ describe("Component", () => {
}), [])
return <div>committed</div>
}).pipe(
Component.withOptions({ scopeCommitTimeout: "10 millis" }),
Component.withContext(runtime.context)
)