Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report
Generated by PR Enrichment workflow | View current CI run |
There was a problem hiding this comment.
Approval waits on an engineering owner's decision. spec:AST-080 DEC-5 and architecture:react-component-runtime INV13 rule out a component lazy-loading touch code, so keeping this approach needs an exception in those records and approval of this head's record changes (Toast FR4's first-move sentence and its three tradeoffs, the FR6 bottom gutter, and the fifth spec:AST-094 FR19 exception). An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. If the lazy load stays, these items also need fixing:
- When the claim's chunk fails to load (offline, or after a deploy removes it),
React.lazythrows while the first toast renders and unmounts everything up to the nearest error boundary, so resolve a failed load to a claim that renders nothing and add a test for it (lazyToastSwipeClaim.ts). .changeset/toast-first-move-claim.mdsays importing Toast or LayerProvider "costs nothing more", but the eager output still grows by about 0.5 KB gzip and the single-bundle size grows by about 24 KB, so please correct the wording.- The first-move claim fixes a page scroll seen in iOS Safari, and this head changes when that claim attaches, so please add an iOS Safari run of this head (a downward swipe on a bottom toast over a scrolled page after the claim has loaded) because Chromium and Playwright WebKit runs do not stand in for Safari.
[Automated review]
| const LazyToastSwipeClaim = lazy(async () => | ||
| loadToastSwipeClaim().then(module => ({ | ||
| default: module.ToastSwipeClaim, | ||
| })), | ||
| ); |
There was a problem hiding this comment.
If this import() rejects (offline, or a deploy removed the chunk), React.lazy throws the rejection while the first toast renders, and everything up to the nearest error boundary unmounts. Toasts often report going offline, so this is the case most likely to hit it. Resolving a failed load to a claim that renders nothing keeps the toast working, with the page keeping the touch as it does before the load:
const LazyToastSwipeClaim = lazy(async () =>
loadToastSwipeClaim().then(
module => ({default: module.ToastSwipeClaim}),
() => ({default: () => null}),
),
);A test where the import rejects would pin it.
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] A touch on a toast is now decided by its first move. A first move toward the toast's edge belongs to the swipe and never scrolls the page; any other first move leaves the page its scroll. The shared gesture host makes that claim. Its code, about 24 KB gzip, loads when the first toast shows, so importing Toast or LayerProvider costs nothing more until then; a touch that starts before it loads stays the page's. |
There was a problem hiding this comment.
"costs nothing more until then" overstates it: the description's own table shows the eager output growing by 620 B (Toast) and 497 B (Layer) gzip over main. Suggest "adds under 1 KB gzip until then".
A release toward the edge dismissed past max(40% of the card's height, 48 px), or as a flick only when it had also travelled 48 px. On any toast up to 120 px tall the two floors are the same distance, so a flick could never dismiss a one-line toast. The flick now needs no travel of its own beyond the slop the swipe already passed. The flick's speed was also timed with Date.now() in the handlers. Browsers deliver touch and pointer moves on the next frame, so the handlers trail the finger by up to two frames (measured in Chromium: a 33 ms flick handled over 55 ms), which halved the speed of a short flick. It is now timed by the input events' own timeStamp. A bottom toast keeps its 16 px gap above the bottom safe-area inset instead of sitting on the inset's edge. Under a coarse pointer it clears at least 34 px plus that gap: Safari reports the inset only with `viewport-fit=cover`, so a page without it read 0 and left the toast in the home indicator's area. Toast's record (FR6) states that gutter. A touch on the card is decided by its first move: toward the edge, the swipe owns the touch; any other first move leaves the page its scroll (Toast FR4). The gesture host makes that claim: the card attaches a one-way pan whose new `firstMoveDecides` option holds a touch from a first move its own way and fails on any other. Toast's own listeners only draw the swipe, and end it once the pan leaves the touch to the page. Importing Toast or LayerProvider now brings in the shared gesture host: about 24 KB gzip on its own (standalone estimate), and nothing more where other touch components already load it.
iOS Safari colors its bottom toolbar from a fixed element at the bottom edge. A swiped toast leaves through that edge inside the toast viewport, and Safari kept the toast's color while the empty viewport still had a box. The viewport now has no box while it holds no toast, and the toolbar returns to the page color once the last toast leaves. The Toast record lists the limit that remains: while other toasts remain, a swiped toast's exit can tint the toolbar until the last toast leaves. The first-move changeset's size figures now read against current main.
The toast's touch claim runs through the shared gesture host. That put the host in every Toast import, and LayerProvider renders a ToastViewport, so every LayerProvider import carried it too: about 24 KB gzip. The claim's pan now lives in ToastSwipeClaim, which lazyToastSwipeClaim loads as Popover's and DropdownMenu's sheets do: when the page is idle after its load event (requestIdleCallback, or the next task in Safari, which has none), or on the first toast's render if that comes first. The pan attaches once the card root is in the DOM. A touch that starts before it loads stays the page's: the gesture host holds only a touch it saw begin. A module that fails to load gives a claim that renders nothing, so the toast stays and the page keeps the touch. Eager output (esbuild split build, gzip -9), main / eager claim / this: Toast 64,488 / 88,222 / 65,311 B; Layer 74,161 / 98,069 / 74,848 B. The claim's chunk is about 23.5 KB gzip. core-single-bundle.test.mjs now takes the app's own output by its entry file: esbuild names an entry point on each chunk an import() starts, too, and the new chunk changed their order.
9137383 to
b1536f7
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision. spec:AST-080 DEC-5 and architecture:react-component-runtime INV13 rule out a component lazy-loading its touch code, so keeping Toast's lazy swipe claim needs an exception in those records, and this head's record changes need approval: Toast FR4's first-move sentence and its three accepted tradeoffs, the FR6 bottom gutter, the toolbar gap and verification rows, and the fifth spec:AST-094 FR19 exception. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner.
- No blocking defect remains: the failed-load fallback, the corrected changeset wording and the iOS Safari run address the earlier findings.
- If the lazy load stays, the third tradeoff should also say that a custom-content toast with no control and no auto-hide cannot be dismissed by touch until the code loads.
- Non-blocking: the
lazyToastSwipeClaim.tsheader can drop the sentences its JSDoc already says (see the inline note).
CI has not run on this head yet.
[Automated review]
| * render, and `preloadToastSwipeClaimWhenIdle`, which loads it at idle | ||
| * @position Internal to Toast: the claim of its swipe | ||
| * | ||
| * The claim brings in the gesture host, so no import of Toast or Layer holds |
There was a problem hiding this comment.
Non-blocking (comment style): this header runs 15 lines, and its prose repeats the JSDoc of whenPageIdle and preloadToastSwipeClaimWhenIdle. Keeping only the constraint would read:
* The claim brings in the gesture host, so no import of Toast or Layer holds
* it. It renders nothing on the server, in the hydrating render, and when its
* module fails to load. The toast then stays, and the page keeps the touch.|
Closed: card 62 chose option C; see #10012. |
Primary intent
Load Toast's swipe claim, and the gesture host under it, when the page is idle after load, or with the first toast if sooner, not with every Toast or LayerProvider import.
other.md: no template fits a size change with one behavior tradeoff. It carries #8047's two commits, rebased ontomain, and stays a draft until maintainers pick it or eager loading.User or maintainer impact
#8047 routes a toast's touch claim through the shared gesture host, and LayerProvider renders a ToastViewport, so every LayerProvider import, desktop-only apps included, gains about 24 KB gzip. Here no import carries it; idle time or the first toast loads it.
Tradeoff: a touch that starts on a toast before the code loads scrolls the page instead of swiping.
Problem and solution fit
ToastSwipeClaimholds the pan;lazyToastSwipeClaimloads it like Popover's and DropdownMenu's sheets, with no new loader: throughrequestIdleCallbackafter the load event (the next task in Safari), or on the first toast's render.Authority
architecture:react-component-runtimeINV13 andspec:AST-080DEC-5 rule out a component lazy-loading touch code; the owners' recorded exception joins this draft once they decide.architecture:component-style-authoringINV6: the size of a component's import.component:ToastFR4 andspec:AST-094FR19, as fix(Toast): a quick flick dismisses a toast of any height #8047 records them.Change and evidence
Eager output, esbuild split build (packages external,
gzip -9, entry plus static imports), onmain217fc4658d:mainClaim chunk: about 23.5 KB gzip. Time until it arrives:
Scope
Testing
Local gates at
b1536f7bf1, three commits onmain(217fc4658d). They ran at74a60e78b7, whose code is the same;b1536f7bf1rewords three comments.pnpm install --frozen-lockfile, the core typecheck, the Storybook build,CI=true pnpm lintand the strict comment lint on the changed files (0 errors in them;pnpm lintalso reportsmain's ownWheelContrast.a11y.chromium.spec.tsimport), Prettier,pnpm check:knowledge,pnpm check:changesetsandpnpm review:pre(0 findings): clean.pnpm test:ui: 790 files, 19,759 tests, all passing,useScrollLockImports.test.tsamong them: no static import path from Drawer, Dialog, BottomSheet or Lightbox reaches the gesture host.maintoo (_template-searcher,tree,global-local); they are tracked as known load-sensitive tests, and none reads Toast.lazyToastSwipeClaim.idle.test.tsx. "loads once the page is idle, before any toast shows" fails without the idle load (load count 0). Three cases pin the scheduler: it waits for the load event, falls back to the next task withoutrequestIdleCallback, and cancels.lazyToastSwipeClaim.test.tsx: a finger that lands before the claim loads is not cancelled, does not drag and does not dismiss; once the module loads, the next touch swipes.lazyToastSwipeClaim.offline.test.tsx: a failed load keeps the toast and leaves the touch to the page.scripts/touch-support-bundle.test.mjs(a split build's eager output of Toast and of Layer carries no gesture module) andscripts/core-single-bundle.test.mjs: 13 of 13.ToastEmptyViewportandToastSwipeScrollinteraction specs, Chromium 4 of 4 and WebKit 3 of 3 (the page-scroll case runs in Chromium only);ToastSafeAreawith the toast outlet contracts, 11 of 11.Writing rubric results
Toast.spec.md, FR4's first-move sentence, FR6's gutter sentences, the readiness count, the Current-state gap on Safari's toolbar, the three first-move tradeoffs and the verification rows, andspec:AST-094FR19's toast exception and its FR18–FR22 row, state what the system does, in the present tense.#numbers,/pull/or/issues/in the changed lines).