create next app#2
Merged
Merged
Conversation
|
|
cursor Bot
pushed a commit
that referenced
this pull request
Jun 22, 2026
…eadline, baseline-relative leak test)
Addresses three issues raised in PR review:
1) Provider-level duration (Copilot, Toast.tsx:132)
Previously, an unset `ToastProps.duration` let Radix's
`ToastProvider duration` (the default for every toast) take effect.
After moving the timer into our wrapper, defaulting `duration` to
`5000` at the `Toast` component boundary silently overrode any
consumer-supplied `<ToastProvider duration={...}>` / `config.toast`
value. Add an internal `ToastDurationContext` populated by
`ToastProvider` (still defaulting to 5000), and resolve in `Toast`
as `toast.duration ?? providerDuration ?? DEFAULT_TOAST_DURATION` --
restoring the original prop > provider > default resolution order.
2) Resume-after-deadline close (Copilot, Toast.tsx:211)
If `handlePause` ran after the auto-close deadline had already
passed (event-loop delay / timer throttling beat the close timer to
the punch), remaining time would clamp to 0 and `handleResume ->
startCloseTimer(0)` short-circuited, leaving the toast open
indefinitely. Track `wasPausedRef` so resume can distinguish
"never paused" from "paused with deadline already elapsed" and
call `onClose(false)` immediately in the latter case.
3) Baseline-relative leak detection (Copilot, Toast.test.tsx:67)
Replaced the brittle `getTimerCount() === 0` assertion with a
semantic check: stub `Document.prototype.activeElement` and
advance time past the leaked deadline. If Radix's auto-close
handler ever fires post-unmount it dereferences
`document.activeElement`, which now flips a boolean we assert
against. Insensitive to unrelated Radix/styled-components internal
timer counts.
Added two new regression tests covering #1 and #2; both fail on `main`
without the corresponding fix and pass with it.
Co-authored-by: Shauli Bracha <shauli.bracha@clickhouse.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.