Skip to content

Fix UI freezes with large workspaces - #536

Merged
gschier merged 8 commits into
mainfrom
perf-large-workspaces
Aug 14, 2026
Merged

Fix UI freezes with large workspaces#536
gschier merged 8 commits into
mainfrom
perf-large-workspaces

Conversation

@gschier

@gschier gschier commented Aug 14, 2026

Copy link
Copy Markdown
Member
  • Batch `model_write` events into a single `model_writes` event per poller drain — importing 3000+ requests no longer freezes the app afterward
  • Bulk-delete workspace children with one statement per table, emitting a single workspace delete event; the model store prunes the subtree (documented on `ModelChangeEvent`)
  • Run `models_delete` off the main thread
  • Only auto-select newly created sidebar items for same-window writes (imports no longer move selection)
  • Dev-only: spawn `yaaknode` from the source vendored dir — in-place resource copies invalidate the macOS code signature and the runtime dies with SIGKILL
  • Add Import Data to the New Workspace menu

Comment thread crates/yaak-models/guest-js/store.ts Fixed
@greptile-apps

greptile-apps Bot commented Aug 14, 2026

Copy link
Copy Markdown

Greptile Summary

The PR batches model-change notifications and moves large deletion work away from the UI thread to prevent freezes in large workspaces. It also makes workspace cascades transactional and adds deferred response-body cleanup.

  • Emits drained model changes as batched model_writes events and updates frontend consumers.
  • Bulk-deletes workspace children under a savepoint before cleaning response files and blob chunks.
  • Adds startup garbage collection for response bodies whose database rows no longer exist.
  • Runs model deletion on a blocking worker and limits sidebar auto-selection to same-window writes.
  • Adds Import Data to the New Workspace menu and adjusts development plugin runtime paths.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
crates/yaak-models/src/queries/workspaces.rs Replaces recursive workspace deletion with an atomic bulk cascade and performs external response-body cleanup only after relational deletion succeeds.
crates/yaak-models/src/queries/http_responses.rs Adds startup garbage collection for blob chunks and response files whose owning response rows no longer exist.
crates-tauri/yaak-app-client/src/models_ext.rs Batches model notifications, runs deletion on a blocking worker, and schedules startup response-body garbage collection.
apps/yaak-client/components/Sidebar.tsx Consumes batched model events and only selects newly created sidebar items originating from the current window.
crates/yaak-models/src/client_db.rs Adds an untracked bulk-delete primitive used where a parent workspace deletion represents the removed subtree.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant DB as SQLite model DB
    participant Blob as Blob DB / response files
    participant UI as Model event consumers
    Caller->>DB: SAVEPOINT delete_workspace
    Caller->>DB: Bulk-delete workspace children
    Caller->>DB: Delete workspace and record parent event
    alt relational deletion succeeds
        Caller->>DB: RELEASE savepoint
        Caller->>Blob: Best-effort response-body cleanup
        DB-->>UI: Batched model_writes event
    else relational deletion fails
        Caller->>DB: ROLLBACK TO and RELEASE savepoint
        DB-->>Caller: Return error without body cleanup
    end
    Note over DB,Blob: Startup GC retries orphaned body cleanup
Loading

Reviews (5): Last reviewed commit: "Make workspace delete cascade atomic on ..." | Re-trigger Greptile

Comment thread crates/yaak-models/src/queries/workspaces.rs Outdated
Comment thread crates/yaak-models/src/queries/workspaces.rs
Comment thread crates/yaak-models/src/queries/workspaces.rs
Comment thread crates/yaak-models/src/queries/workspaces.rs Outdated
@gschier
gschier merged commit d0af512 into main Aug 14, 2026
6 checks passed
@gschier
gschier deleted the perf-large-workspaces branch August 14, 2026 17:15
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.

2 participants