Skip to content

fix(workspaces): make delete/rename dialogs recoverable and batch kernel deletes#622

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/recoverable-workspace-item-dialogs
Draft

fix(workspaces): make delete/rename dialogs recoverable and batch kernel deletes#622
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/recoverable-workspace-item-dialogs

Conversation

@posthog

@posthog posthog Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Why

Users got stuck on a frozen delete/rename dialog whenever the workspace kernel was slow or errored, forcing them to cancel and retry. Both signals trace to WorkspaceItemActionDialogs.tsx: the bulk-delete alert only closed inside the mutation's onSuccess and surfaced no error on failure, while the rename dialog fired mutate() and closed unconditionally on the next line — silently dropping the user's input on a failed rename. Underneath, a multi-item delete fired every workspace.rm at once, which overran the Durable Object memory/storage budget and tripped memory-limit / storage-timeout resets on the server.

What changed

  • Delete alert — surface the failure inline, keep the modal open, and relabel the action to "Retry delete" so the user can retry rather than being wedged with a disabled button. The mutation is reset on close so reopening starts clean.
  • Rename dialog — await the mutation and close only on success. On failure the dialog stays open with an inline error, and the input is now controlled so the user's typed value is preserved for in-place correction and retry.
  • Kernel deleteItems — stream file removals in bounded batches instead of one big Promise.all, so a multi-item delete doesn't load every removal at once and blow the Durable Object budget.

This mirrors the recoverable pattern the Move dialog already uses.

Testing

  • Added a unit test asserting deleteItems streams removals with bounded concurrency (≤4 in flight) rather than all at once.
  • pnpm check (format + lint + types) and the full test suite pass.

Note: the dialog behavior is a client-side UX change; I verified it via code review and the mutation-state logic, but could not spin up the full Cloudflare app in this environment to record the flow.


Created with PostHog Code from an inbox report.


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Review in cubic

…nel deletes

The bulk-delete alert only closed inside the mutation's onSuccess and had no
error surface, and the rename dialog fired mutate() then closed
unconditionally on the next line. When the workspace kernel was slow or
errored, users were left with a frozen/disabled dialog or a silently
dismissed rename that lost their input.

- Delete alert: surface the failure inline, keep the modal open, and relabel
  the action to "Retry delete" so the user can retry instead of being wedged.
  Reset the mutation on close so a reopen starts clean.
- Rename dialog: await the mutation, close only on success, and keep the
  dialog open with an inline error and the user's typed value preserved
  (controlled input) so they can correct and retry in place.
- Kernel deleteItems: stream file removals in bounded batches instead of
  firing every workspace.rm at once, so a multi-item delete doesn't blow the
  Durable Object memory/storage budget.

Generated-By: PostHog Code
Task-Id: d66ba4e3-c24d-4160-80d0-8d3b1ff22e2b
@github-actions

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit ba561db.

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

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

0 participants