Repository navigation
Conversation
The swipe layer loads lazily, and the swipeActions tests waited for its first render with `waitFor`'s one-second window. On a busy machine the module's first load takes longer: the warm-up `beforeAll` timed out and every swipeActions test failed (red under parallel full-core runs, on main too). Both tests now await the module itself inside `act`, however long the load takes, then check the panel synchronously. With the first load slowed to 1.5 s, the old suite fails (the 26 swipeActions tests never run) and the new one passes.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Recommended for approval: both tests now wait for the swipe layer's module instead of a one-second waitFor window, keep every existing assertion, and change no product code. With the module's first load slowed to 1.5 s the old warm-up fails while the new one passes, and the new checks still fail when the layer renders no panel. Nothing further is needed from you.
[Automated review]
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewModified ComponentsItem (@astryxdesign/core) · View in Storybook
Component Size
Sizes are gzip. Import counts the JavaScript the import loads eagerly; CSS counts the package stylesheet rules referenced by the modules it can load from its own package, lazily loaded ones included. Bundle Size SummaryGzip figures measure each package's entry file, not the code an import pulls in.
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
…a timed hook The swipeActions warm-up awaited the lazy swipe layer's first load inside beforeAll, which the hook timeout bounds; on a busy machine that load (the gesture system with it) can outlast it, and the describe block's 26 tests are skipped. The module is now imported at the top of the file, during collection, which no timeout bounds; the warm-up resolves from the cache. Item.swipeLayer.test.tsx still covers the lazy load itself.
There was a problem hiding this comment.
Recommended for approval: both Item test files now wait for the swipe layer's module instead of a one-second waitFor window, keep every existing assertion, and change no product code. With the module's first load slowed to 1.5 s the old warm-up fails while the new one passes, and the new checks still fail when the layer renders no panel. The red pr-interaction and test checks are unrelated to this change: this branch predates playwright.interaction.config.ts on main, so merging main should clear them.
[Automated review]
There was a problem hiding this comment.
Recommended for approval: both Item test files now wait for the swipe layer's module instead of a one-second waitFor window, keep every existing assertion, and change no product code. With the module's first load slowed to 1.5 s the old suites fail while the new ones pass, and the new checks still fail when the layer renders no panel. One optional follow-up outside this pull request: List.test.tsx still waits for the same swipe panel with waitFor and fails the same way when the first load is slow.
[Automated review]
List's swipeActions case waited for the lazily loaded ItemSwipeLayer's panel inside waitFor's one-second default, which a busy machine outlasts on the module's first load. Like Item's tests, the file now imports the layer while it is collected, which no timeout bounds, and the case renders its panel from that cached module.
There was a problem hiding this comment.
Recommended for approval: the three swipe tests now wait for the swipe layer's module instead of a one-second waitFor window, keep every existing assertion, and change no product code. With the module's first load slowed to 1.5 s the old tests fail while the new ones pass, and the new checks still fail when the layer renders no panel. Nothing further is needed from you.
[Automated review]
…and sheet module before its one-second wait (#8896) ## Why The Tokenizer case of `useAnnounceRenderedText.adopters.test.tsx` fails at random on a busy machine, on pull requests that don't touch Tokenizer: "Unable to find a label with the text of: Search Tags". ## What led to it Tokenizer loads its touch sheet on demand (`loadTokenizerBottomSheet` in `Tokenizer.tsx`). The case opens the sheet and waits one second, the default `findByLabelText` wait, for the sheet's search field, so that second covers the sheet module's first load as well as the open. The load alone takes about a second on an idle machine. With vitest's default worker count on a 166-core box (165 workers), the case failed in all three full core runs I made; with 16 workers it passed in both, and it passes alone. ## Options and tradeoffs - Raise the wait: hides the cause, and a slower machine still fails. - Load the sheet eagerly in Tokenizer: changes product code, and the on-demand load is deliberate (`component:Tokenizer` PR6). - Load the module in the test before the open, so the wait covers only what the test checks (this pull request). ## Why this choice The case checks that the sheet hands its own content to the shared announcement module, not how its code loads. It now awaits `import('../Tokenizer/TokenizerBottomSheet')` before it renders. That load counts against the test's 30-second budget, never against the one-second wait. The other lazily loaded sheets and layers have the same fix open in #8642 (Selector, MultiSelector), #8352 (Item's swipe layer) and #8353 (DropdownMenu's sheet). ## How to check it 1. Make the sheet module's load cost CPU, as on a starved machine: in a copy of the test, mock `../Tokenizer/TokenizerBottomSheet` with a factory that busy-waits 1.2 s before returning the real module. 2. Run that copy. On main the Tokenizer case fails with the error above; with this change all 8 cases pass. 3. Run the real test without the mock: all 8 pass. ## Evidence - With the 1.2 s busy-wait: 3 of 3 runs fail on main, 3 of 3 pass here. - The hooks and Tokenizer test folders pass (46 files, 747 tests), along with core's typecheck and `pnpm check:repo`. - A `setTimeout` delay in the mock did not reproduce it: the sheet rendered before the delay ended. A busy-wait starves the event loop the way load does. Local gates at 4e6b38d: Prettier and ESLint pass on the changed file; the root build passes; the core UI suite passes, and the adopters file passes alone in 5 runs of 5; the node project passes except two process-timing cases in `packages/cli/foundation/release/cache.test.mjs`, which pass when that file runs alone (34 of 34), on this head and on main.
|
Superseded by #9447, which carries the same fix for these three swipe sites plus DropdownMenu ×2 and Resizable. |
Review only this PR's change: vjeux/astryx@a00afee...8284b8b
Why
On a busy machine, all 26
swipeActionstests inItem.test.tsxfail together, on main too. The suite's warm-up waited for the lazily loaded swipe layer insidewaitFor's one-second window; when the module's first load takes longer, the warm-up times out and the whole block fails. That breaks parallel runs of the core suite, in CI shards and locally, on changes that have nothing to do with Item.What led to it
We run the full UI suite many times in parallel while bringing touch components to native behavior, and Item's swipe tests kept failing on unrelated changes.
Options and tradeoffs
waitFor's timeout: a bigger window, still a race against the machine's speed.await import('./ItemSwipeLayer')insideact, then check synchronously. The lazy component keeps the resolved module, so every row below renders as before.Why this choice
The test waits on what it needs, the module being loaded, not on a clock, and no product code changes.
Item.swipeLayer.test.tsx, and the oneList.test.tsxcase that waited on the layer the same way, get the same fix.How to check it
pnpm exec vitest run packages/core/src/Item/Item.test.tsx packages/core/src/Item/Item.swipeLayer.test.tsx packages/core/src/List/List.test.tsx: all pass../ItemSwipeLayerwith a factory that waits 1.5 s and returns the real module. On main, the warm-up times out and the 26 swipe tests never run. With this change all 80 pass, even with a 31 s delay.Evidence