Skip to content

Fix row bulk delete freeze#3063

Merged
HarshMN2345 merged 2 commits into
mainfrom
fix-row-delete-freeze
May 27, 2026
Merged

Fix row bulk delete freeze#3063
HarshMN2345 merged 2 commits into
mainfrom
fix-row-delete-freeze

Conversation

@HarshMN2345
Copy link
Copy Markdown
Member

What does this PR do?

(Provide a description of what this PR does.)

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 27, 2026

Greptile Summary

This PR fixes a UI freeze that occurred when bulk-deleting rows in the spreadsheet view. The fix snapshots the target row IDs before clearing reactive state, resets selections and triggers a grid re-render up-front (before any awaited API calls), and moves $spreadsheetLoading = false into the finally block so the loading indicator always dismisses.

  • Row IDs are captured into rowIdsToDelete before selectedRows/selectedRowForDelete are cleared, ensuring the correct set of IDs is passed to all delete API calls and the success notification.
  • The grid is force-re-rendered (spreadsheetRenderKey.set) immediately after clearing state, which is the core fix preventing the freeze while API calls are in flight.
  • A single row selected via bulk checkbox now routes through the deleteRow (single-row) endpoint instead of the batch path, which is a minor but reasonable behavioral change.

Confidence Score: 4/5

Safe to merge; the change correctly prevents the freeze and follows the existing error-handling pattern with no new API surface.

The logic restructuring is clean and the state reset order is correct. The only outstanding item is a now-dead || 1 fallback in the deletedRowsCount line, which is harmless in practice.

No files require special attention beyond the single changed component.

Important Files Changed

Filename Overview
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/spreadsheet.svelte Fixes UI freeze during bulk delete by snapshotting row IDs, clearing selections, and triggering a grid re-render before awaiting API calls; introduces a now-unreachable `

Reviews (1): Last reviewed commit: "lint issue" | Re-trigger Greptile

showDelete = false;
let hadErrors = false;
const rowIdsToDelete = selectedRowForDelete ? [selectedRowForDelete] : [...selectedRows];
const deletedRowsCount = rowIdsToDelete.length || 1;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 The || 1 fallback is now unreachable dead code. rowIdsToDelete is built as [selectedRowForDelete] or [...selectedRows], so when any deletion occurs its length is always ≥ 1. In the original code the fallback was needed because selectedRows.length was checked separately and could be 0 when only selectedRowForDelete was set — but that split no longer exists here.

Suggested change
const deletedRowsCount = rowIdsToDelete.length || 1;
const deletedRowsCount = rowIdsToDelete.length;

@HarshMN2345 HarshMN2345 merged commit 594c7a3 into main May 27, 2026
4 checks passed
@HarshMN2345 HarshMN2345 deleted the fix-row-delete-freeze branch May 27, 2026 13: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.

3 participants