Staged edits are silently dropped when a global search is active

オープン
#1,589 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

  • #1590 @MarianBeuther による — マージされずにクローズ

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
postgresql, typescript
領域
backend, frontend

調査の方向性

Start with ExpandableSearchControl, which clears the applied search term through closeRowSearch when disabled becomes true, and with ActiveTableView, which passes hasStagedChanges into it. Then follow saveStagedRows into useActiveTableUpdateMany to see why collection.update runs against the unfiltered rows. Done means a staged edit on a row found through global search is saved to the database, and updateMany errors are surfaced. A linked open pull request (#1590) already targets this, so check it before starting.

索引モデルが issue の本文から書いたものです。

説明

Studio distribution

Embedded (@prisma/studio-core in my own app). Also reproduced with this repo's pnpm demo:ppg.

Database

PostgreSQL

Database version

PostgreSQL 17 (our app); PGlite via @prisma/dev 0.24.13 (pnpm demo:ppg)

Prisma & studio-core versions
@prisma/studio-core: 0.34.1 (embedded via createStudioBFFClient + createPostgresAdapter, BFF uses createPostgresJSExecutor)
prisma/studio main @ d3578a7 (pnpm demo:ppg)
Operating system & browser

macOS 26.6, Chromium (Playwright 1.60)

Steps to reproduce

Using pnpm demo:ppg (no custom code), table team_members (400 seeded rows), infinite scroll off:

  1. Open http://localhost:4310/#schema=public&table=team_members.
  2. Open global search and search for usr_demo_063. The single matching row is shown. Unfiltered, it sits at offset 60, so it is not on the first page.
  3. Double-click the title cell of that row, type a new value, press Enter. "Save 1 row" appears.
  4. Click "Save 1 row" → "yes, write to db".

Control: same steps, but replace step 2 with a SQL WHERE filter id = 'usr_demo_063'. The update is sent and persisted.

This looks like the same failure class as #1466 / #1545 (the save targets a rows collection that doesn't contain the edited row). #1545 fixed the infinite-scroll path; the global-search path still has it.

Expected behavior

An update is sent to the BFF and the new title is persisted, like it is with a column/SQL filter.

Actual behavior
  • After step 3 the search input is empty and the grid shows the unfiltered first page. The edited row is no longer visible.
  • After step 4 no update request reaches /api/query, no error is shown, "Save 1 row" stays, and after reload the DB still has the old value.
  • 100% reproducible with any row that is not on the unfiltered first page. Rows that are also on the first page save fine, which makes it look intermittent in larger tables.

Cause, from reading the source on main:

  • ActiveTableView renders <ExpandableSearchControl disabled={hasStagedChanges} onBlockedInteraction={triggerDiscardButtonWiggle} …>.
  • ExpandableSearchControl has:
    useEffect(() => {
      if (!disabled) return;
      closeRowSearch();
    }, [closeRowSearch, disabled]);
    
    and closeSearch() calls applySearchValue("").
  • So staging the first edit clears the applied search term, and the visible window / mutationQueryProps switch to the unfiltered rows collection.
  • saveStagedRows() → useActiveTableUpdateMany → collection.update(rowIds, …) then runs against a collection that doesn't contain the edited row. That throws, and updateMany.mutate(…, { onSuccess }) has no onError, so the failure is silent.

Possible fixes:

  • Keep the applied search term while edits are staged: block the input (as onBlockedInteraction already does) instead of closing it.
  • Surface updateMany errors.
Logs

No error is logged in the browser console and no request reaches the BFF.


Two smaller things in createPostgresJSExecutor (0.34.1), noticed while debugging. Happy to split them into separate issues:

  1. lintSql diagnostic positions overshoot. Statements are linted as EXPLAIN (FORMAT JSON) ${statement}, but createLintDiagnosticsFromPostgresError gets sql: statement without subtracting the prefix length from Postgres' position. Highlights land 22 characters too far right and get clamped to the end of the statement.
  2. executeTransaction skips normalizeTemporalResult. execute normalises timestamp/date, executeTransaction returns raw postgres.js rows. Outside UTC, rows returned from a multi-row save disagree with the same rows from query.
主要言語
TypeScript
スター
2.2k
フォーク
91
平均マージ
15時間 27分
マージ済み PR(30日)
3

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

prisma/studio のほかの issue

prisma/studio の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。