Skip to content

feat: persist table sort order to localStorage#354

Merged
BYK merged 2 commits into
mainfrom
feat/persist-table-sort
May 16, 2026
Merged

feat: persist table sort order to localStorage#354
BYK merged 2 commits into
mainfrom
feat/persist-table-sort

Conversation

@BYK
Copy link
Copy Markdown
Owner

@BYK BYK commented May 16, 2026

Summary

  • Persist sort column + direction to localStorage for all 8 sortable tables in the web dashboard
  • Default sort to most-recent-first (descending) on date/recency columns for first-time visitors
  • Graceful degradation when localStorage is unavailable (private browsing, quota errors)

Details

Single file change: packages/gateway/src/ui.ts

  1. Added data-table-id to all 8 sortable tables (6 inline + 2 via renderLiveSessionsTable parameter)
  2. Added data-default-sort="desc" to 6 recency date columns (Created, Updated, Last Activity, Last Active)
  3. Replaced inline sort JS: extracted sortTable(th, dir) that persists {col, dir} to localStorage under lore-sort:{tableId}, plus restore-on-load logic that checks localStorage first, falls back to data-default-sort

localStorage key format: lore-sort:{tableId}{"col": 0, "dir": "desc"}

BYK added 2 commits May 16, 2026 00:01
Add localStorage persistence for sort column + direction across all
sortable tables in the web dashboard. On page load, saved sort is
restored; if no saved state exists, tables with a date/recency column
default to most-recent-first (descending).

- Add data-table-id to all 8 sortable tables for unique identification
- Add data-default-sort="desc" to 6 recency date columns
- Extract sortTable() function that persists {col, dir} to localStorage
- Restore saved sort on DOMContentLoaded with fallback to defaults
- Graceful degradation when localStorage is unavailable
Restrict saved dir to 'asc'|'desc' to prevent classList.add() from
throwing on corrupted/tampered localStorage values.
@BYK BYK merged commit 3e8b77b into main May 16, 2026
12 of 13 checks passed
@BYK BYK deleted the feat/persist-table-sort branch May 16, 2026 00:11
@craft-deployer craft-deployer Bot mentioned this pull request May 16, 2026
6 tasks
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.

1 participant