Skip to content

create next app#2

Merged
serdec merged 3 commits into
mainfrom
feat/create-next-app
May 24, 2023
Merged

create next app#2
serdec merged 3 commits into
mainfrom
feat/create-next-app

Conversation

@serdec

@serdec serdec commented May 24, 2023

Copy link
Copy Markdown
Member

No description provided.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@serdec serdec merged commit fb2ae69 into main May 24, 2023
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants