Skip to content

Keep database query typing off result grids - #388

Open
open-session-os-tella-dev[bot] wants to merge 1 commit into
mainfrom
auto-daily-open-session-react-performance-202609140700-os-01a09eb7-33c5-7289-93a5-3f2b7d20d5f5
Open

open-session-os-tella-dev[bot] wants to merge 1 commit into
mainfrom
auto-daily-open-session-react-performance-202609140700-os-01a09eb7-33c5-7289-93a5-3f2b7d20d5f5

Conversation

@open-session-os-tella-dev

Copy link
Copy Markdown
Contributor

User-facing hot path

Typing in the Databases query editor while a large result is visible. The query editor's transient sql state lived in the page-level Databases component, so each keystroke rendered the database list, detail chrome, and the full result grid again.

This change keeps the editor's sql and running state in DatabaseQueryEditor. Query results and errors remain in the adjacent DatabaseQuery component, so typing does not render the existing result grid.

Reproduction

  1. Start .agents/start.sh on an isolated OPENSESSION_DEMO=1 state directory.
  2. Connect agent-react-devtools to a headed CDP browser.
  3. Create an empty local fixture database.
  4. Run a recursive read-only query that returns 1,000 rows and keep that result visible.
  5. Warm up once, then profile three runs that type the same 61-character SQL string at 12 ms per character.
  6. Export each React DevTools profile and compare commit durations and component render counts.

Benchmark

Medians across the three measured runs:

Metric Before After Delta
Interaction commits 61 61 0%
Total commit time 771.2 ms 36.6 ms -95.3%
Median commit duration 6.8 ms 0.6 ms -91.2%
DataGrid renders 61 0 -100%

In the steady baseline runs, DataGrid averaged 10.5 to 12.0 ms per render and peaked at 49.9 to 50.1 ms. It did not render during typing after the change.

Validation

  • bun test packages/core/opensession-server/src/server/routes/databases.test.ts packages/core/opensession-server/src/frontend/lib/api.test.ts
  • bun run typecheck
  • bun run check
  • Desktop web at 1440x900: query draft survived Rows → Query, Run returned one row, and Ctrl/Cmd+Enter ran the 1,000-row fixture query.
  • Phone/PWA at 390x844: the same draft retention and one-row query passed, with the shipped phone layout intact.

Behavior preservation

The query text, run state, result, error handling, API call, keyboard shortcut, copy, and grid output are unchanged. DatabaseQuery stays mounted when Rows is selected, so switching tabs still preserves an in-progress query draft. Selecting another database still clears the draft, result, and error as before.

Limitations

The benchmark uses React's development build because agent-react-devtools connects to the local dev server. Production also runs the React Compiler, so absolute timings differ. The fixture is generated locally and does not use production session data.

Started by Jaap Frolich in this OS session

@open-session-os-tella-dev

open-session-os-tella-dev Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

🤖 OS review · request changes · quality 3/5 · risk low

Safe once the P1 below is fixed. Database selection can temporarily retain and execute the previous database’s query.

🟢 Risk low · recovery in minutes
A revert restores the UI; query drafts and results are transient.

  • No tests: Databases.tsx changes runtime state ownership without corresponding test changes.

1 inline comment below.

Reviewed 54765ba · GPT-5.6 Sol · open session · labels: os-auto-fix fix and push · os-adversarial deeper pass · os-simplify cleanup

🔁 Not merge-ready and no live session owns this branch — add the os-auto-fix label and I'll fix the findings automatically.

@vercel

vercel Bot commented Sep 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
opensession Ready Ready Preview Sep 14, 2026 7:17am UTC

@open-session-os-tella-dev open-session-os-tella-dev Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OS review · 54765ba

</>
)}
<DatabaseQuery
databaseId={database.id}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 P1 — Bind query state to the selected database, not stale detail

When database A is loaded and the user selects B, loadDetail(B) leaves detail pointing at A until its request completes. This component therefore still receives A's ID, so neither reset effect runs. If the user opens Query before B's detail arrives, A's draft and result remain visible and Run posts to /databases/A/query. Previously both resetting and execution used selectedDatabaseId, so they switched to B immediately. Pass the selected ID and key the query component by it, or withhold the query UI until database.id === selectedDatabaseId; keying also prevents an in-flight query for A from publishing into B's state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants