Skip to content
This repository was archived by the owner on Oct 26, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changeset/13120-backfill-checkbox-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

No package released: test only. Two `@object-ui/app-shell` backfill tests now wait for the backfill checkbox's counted name instead of reading it synchronously: the Studio publish-backfill test's unchecked case (as its other two cases already did), and the pending-changes sheet's "one choice" case. The drill-in reads the record count after the option renders, so a synchronous read raced that count on a slow runner (objectui#13120). No source, export, type or behaviour changes.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ describe('the backfill choice is offered only where the batch door would honour
await settled();
const options = await screen.findAllByTestId('draft-backfill-option');
expect(options).toHaveLength(1);
const box = screen.getByRole('checkbox', { name: 'Backfill default (12 existing records)' });
// Waited for: the drill-in reads the count only after the option draws, so the
// name carries no number until that read lands.
const box = await screen.findByRole('checkbox', { name: 'Backfill default (12 existing records)' });
expect(box).not.toBeChecked();
// The literal the door would write is shown beside it.
expect(options[0]).toHaveTextContent('= false');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,14 @@ afterEach(() => {
vi.unstubAllGlobals();
});

/** Open the sheet the way the author does: the header's Publish, which opens it to confirm. */
/**
* Open the sheet the way the author does: the header's Publish, which opens it to confirm.
*
* Resolves once the backfill option is drawn, NOT once its count is: the drill-in
* asks the adapter for the record count only after the option renders, and names
* no number until that read lands. A read of the counted name (N) is therefore a
* waiting `findByRole`, never a synchronous `getByRole`, which races the count.
*/
async function openSheet(): Promise<HTMLElement> {
render(
<MemoryRouter initialEntries={[`/studio/${PACKAGE_ID}/interfaces`]}>
Expand Down Expand Up @@ -228,7 +235,8 @@ describe('Studio publish with the default backfill (objectui#12929)', () => {

it('unchecked: the publish names no field, so nothing is written into existing rows', async () => {
const sheet = await openSheet();
expect(within(sheet).getByRole('checkbox', { name: new RegExp(`\\b${N}\\b`) })).not.toBeChecked();
// Waited for, like the cases above: the count lands after the option draws.
expect(await within(sheet).findByRole('checkbox', { name: new RegExp(`\\b${N}\\b`) })).not.toBeChecked();

fireEvent.click(within(sheet).getByTestId('draft-changes-publish'));

Expand Down
Loading