Skip to content

fix(tables): clear row selection when the visible rows change - #3182

Merged
HarshMN2345 merged 2 commits into
mainfrom
fix-table-selection-across-pages
Aug 24, 2026
Merged

fix(tables): clear row selection when the visible rows change#3182
HarshMN2345 merged 2 commits into
mainfrom
fix-table-selection-across-pages

Conversation

@HarshMN2345

@HarshMN2345 HarshMN2345 commented Aug 24, 2026

Copy link
Copy Markdown
Member

The bug: row selection in MultiSelectionTable was keyed to a static computeKey, not to which rows were actually on screen. Select some rows, paginate (or search) to a different set, and the old ids stayed selected. Hitting "select all" + delete on the new page then deleted rows the user never saw checked — reported from both Storage and Databases, including one case of file loss that needed manual recovery.

Fix: selection now clears whenever the URL changes (page.url.href — covers pagination, search, filters), via an $effect.pre in multiSelectTable.svelte. Also keyed five previously-unkeyed {#each} row blocks (bucket files, users, memberships, platforms, backups) so Svelte doesn't reuse row DOM across renders with stale identity — a second, independent path to the same bug.

The clear is deliberately scoped to URL changes rather than computeKey changes: keying it on computeKey would also wipe the selection mid-flow after a partial delete failure, leaving the confirm dialog reporting 0 rows.

Test plan

  • format, check (0 errors), lint (0 errors), test:unit (265 passing), build all clean
  • Manual browser pass: select rows → paginate → select all → delete → confirm only current-page rows are gone

Selection state in MultiSelectionTable stuck around across pagination
and search, keyed only on row id. Selecting rows, then paginating to a
different page and hitting "select all" would carry the old ids into
the new batch delete, silently deleting rows the user never saw
selected. Reported from Storage and Databases in production.

Reset selection whenever the URL changes, and key the previously
unkeyed row each-blocks (files, users, memberships, platforms,
backups) so Svelte doesn't reuse row elements across renders.
@appwrite

appwrite Bot commented Aug 24, 2026

Copy link
Copy Markdown

Console (appwrite/console)

Project ID: 688b7bf400350cbd60e9

Sites (1)
Site Status Logs Preview QR
 console-stage
688b7cf6003b1842c9dc
Ready Ready View Logs Preview URL QR Code

Tip

Roll back Sites deployments instantly by switching between versions

@greptile-apps

greptile-apps Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR resets multi-table selection when the active URL changes and keys table rows by stable resource IDs to prevent stale selections from carrying across visible datasets.

  • Derives the table remount key from the URL and existing compute key.
  • Clears selected row IDs before rendering a URL-driven dataset.
  • Adds keyed row rendering for users, memberships, backups, platforms, and files.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains.

No blocking failure remains.

Important Files Changed

Filename Overview
src/lib/components/multiSelectTable.svelte Adds URL-aware selection clearing and remounting without an eligible follow-up defect established.
src/routes/(console)/project-[region]-[project]/auth/+page.svelte Keys user rows by their API resource IDs.
src/routes/(console)/project-[region]-[project]/auth/user-[user]/memberships/+page.svelte Keys membership rows by their API resource IDs.
src/routes/(console)/project-[region]-[project]/databases/database-[database]/backups/table.svelte Keys backup archive rows by their API resource IDs.
src/routes/(console)/project-[region]-[project]/overview/platforms/+page.svelte Keys platform rows by their API resource IDs.
src/routes/(console)/project-[region]-[project]/storage/bucket-[bucket]/+page.svelte Keys API-backed file rows by file ID, including incomplete upload records.

Reviews (2): Last reviewed commit: "revert: drop the new component-test scaf..." | Re-trigger Greptile

This repo has no existing Svelte component test pattern, so covering
the fix meant inventing one from scratch: jsdom localStorage/
ResizeObserver shims plus a harness component, none of which serves
anything else here. Not warranted for a bug fix. The fix itself
(selection reset on URL change + keyed row loops) stands on its own.
@HarshMN2345
HarshMN2345 merged commit 4d7ffd6 into main Aug 24, 2026
4 checks passed
@HarshMN2345
HarshMN2345 deleted the fix-table-selection-across-pages branch August 24, 2026 06:46
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