Skip to content

fix(studio): re-seed the data browser when a same-table view arrives via the URL - #311

Closed
prisis wants to merge 5 commits into
alphafrom
advisor/292-studio-generate-rows-bulk
Closed

prisis wants to merge 5 commits into
alphafrom
advisor/292-studio-generate-rows-bulk

Conversation

@prisis

@prisis prisis commented Aug 2, 2026

Copy link
Copy Markdown
Member

Branched before #288/#289 landed, so it needs a rebase onto current alpha before merge.

Commits

  • fix(studio): re-seed the data browser when a same-table view arrives via the URL
  • fix(studio): drop the render-phase facets ref write in clearFacets
  • fix(studio): keep the URL mirror alive past the first echoed change
  • perf(studio): insert generated rows through the bulk importShard RPC
  • fix(studio): stop reporting a false success when a batch inserts nothing

Files this branch still changes relative to alpha

packages/studio/__tests__/features/data/data-browser.test.tsx
packages/studio/__tests__/features/data/generate-rows-dialog.test.tsx
packages/studio/__tests__/features/data/use-facets.test.tsx
packages/studio/src/features/data/data-browser.tsx
packages/studio/src/features/data/generate-rows-dialog.tsx
packages/studio/src/features/data/hooks/use-data-browser.tsx
packages/studio/src/features/data/hooks/use-facets.tsx
packages/studio/src/features/data/hooks/use-generate-rows.ts
packages/studio/src/locales/en.ts

prisis and others added 5 commits August 1, 2026 18:03
…via the URL

The per-table view re-seed was gated on tableParam alone, so applying a
saved query that names the already-open table (shard/search/filters
change, table doesn't) left the browser reading/writing the previous
shard while the URL showed the new one. Widen the seed identity to also
compare the incoming view against what was last mirrored to the host, so
the URL round trip from the user's own typing stays a fixed point instead
of reintroducing a reset-on-every-keystroke loop.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
clearFacets wrote facetsRef.current = {} directly from inside the
render-phase re-seed block — the exact render-may-not-commit impurity
useMirroredRef exists to remove. A discarded render could clear the ref
without the paired setFacets({}) ever committing, letting toggleFacet
re-add an already-open facet instead of closing it. setFacets({}) alone
is sufficient; useMirroredRef's own effect publishes the cleared value
once the render actually commits.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
seededViewKey only ever advanced inside the re-seed branch, but the
same-table-apply check deliberately treats the mirror's own echo as a
non-event (comparing against emittedViewKeyRef instead). That left
seededViewKey permanently behind incomingViewKey after the FIRST echo:
the mirror's guard (seededViewKey !== incomingViewKey) then blocked
every future commit, and the next unrelated render misread whatever the
user had typed since as a fresh external apply — reverting the second
change and wiping staged edits, the open cell editor, and the page
offset with it.

Advance seededViewKey on every committed render whose incoming view is
accounted for, not only inside the re-seed branch: a genuine apply
still runs the full reset, but the harmless echo case now also catches
seededViewKey up (touching nothing else), keeping the mirror guard's
invariant actually true instead of only true immediately after a reset.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The "Generate rows" dialog inserted its fixture one row at a time through
writeRow — 200 Worker/DO round trips for a full-size batch, each its own
storage transaction, CDC record, and subscription broadcast. Route it
through the same bulk importShard admin RPC the Export/Import panel
already uses: one call, one transaction. importShard's row contract
already fits generated docs (id-less rows accepted, explicit ids
preserved) and sits behind the same admin-token gate as writeRow.
Partial-failure semantics improve as a side effect — every row is
attempted and reported instead of the batch stopping at the first
failure — and a same-seed conflict is surfaced as a skip, not an error.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
insertBatch returned a bare undefined on any importShard call with no
row-level errors, so a conflict-only result (every generated row's
planned _id collided with an existing one, e.g. a re-click with an
unchanged seed) was indistinguishable from every row landing. The
dialog then showed "Inserted N rows successfully" using the requested
row count, not the actual insert count of zero.

Return the real inserted/conflicts counts alongside the error string so
the caller can never mistake a conflict-only batch for a real insert;
the dialog now surfaces "Inserted 0 of N rows — N skipped as id
conflicts" instead.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@prisis, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 58 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 25be990f-b6df-4a89-a801-2b8906dbf2c5

📥 Commits

Reviewing files that changed from the base of the PR and between 6a4dd72 and 7ae5081.

⛔ Files ignored due to path filters (3)
  • packages/studio/__tests__/features/data/data-browser.test.tsx is excluded by !**/__tests__/** and included by packages/**
  • packages/studio/__tests__/features/data/generate-rows-dialog.test.tsx is excluded by !**/__tests__/** and included by packages/**
  • packages/studio/__tests__/features/data/use-facets.test.tsx is excluded by !**/__tests__/** and included by packages/**
📒 Files selected for processing (6)
  • packages/studio/src/features/data/data-browser.tsx
  • packages/studio/src/features/data/generate-rows-dialog.tsx
  • packages/studio/src/features/data/hooks/use-data-browser.tsx
  • packages/studio/src/features/data/hooks/use-facets.tsx
  • packages/studio/src/features/data/hooks/use-generate-rows.ts
  • packages/studio/src/locales/en.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@netlify

netlify Bot commented Aug 2, 2026 •

Copy link
Copy Markdown

❌ Deploy Preview for lunorash failed.

Name Link
🔨 Latest commit 7ae5081
🔍 Latest deploy log https://app.netlify.com/projects/lunorash/deploys/6a6f0b7de202f00008f66aab

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Thank you for confirming the Contributor License Agreement! 🙏

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@prisis

prisis commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

Closing: this PR was opened in error by an automated run, outside the scope of its task.

No work is lost — the branch is retained on origin and this PR can be reopened at any time.

Context: this branch predates the merges of #288 and #289, so much of its content is already on alpha, and it would need a rebase before being reviewable. Reopening deliberately, after a rebase, is preferable to leaving it open in this state.

@prisis prisis closed this Aug 2, 2026
@prisis
prisis deleted the advisor/292-studio-generate-rows-bulk branch August 2, 2026 09:46
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using our GitHub Discussions tab for questions.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant