Skip to content

fix(command-palette): persist command ids and rehydrate catalog items… - #971

Merged
thlpkee20-wq merged 1 commit into
RevoraOrg:masterfrom
samkelly-dev:fix/command-palette-recent-persistence
Oct 22, 2026
Merged

thlpkee20-wq merged 1 commit into
RevoraOrg:masterfrom
samkelly-dev:fix/command-palette-recent-persistence

Conversation

@samkelly-dev

Copy link
Copy Markdown
Contributor

Closes #939

Summary

Fixes an issue where recent commands in the CommandPalette lost their onExecute callbacks after page reloads because JSON.stringify stripped function references when storing full CommandItem objects in localStorage.

Changes

  • Persistence format: Updated useCommandPalette to store recent items as lightweight { id: string, timestamp: number } entries rather than full command objects.
  • Catalog hydration: On reload/hydration, recent entries are looked up in COMMAND_BY_ID. Unknown or removed command IDs are filtered out and cleaned up in storage.
  • Legacy migration: Added backward-compatible parsing that transparently migrates stored legacy object arrays or string arrays to the new format upon loading.
  • List capping: Enforced RECENT_LIMIT capping on both load and insertion.
  • Tests:
    • Added regression test demonstrating onExecute execution after simulated reload.
    • Added tests for catalog rehydration, dropping unknown IDs, legacy object migration, and storage error handling.

Verification

  • npx vitest run src/components/CommandPalette/ src/hooks/useCommandPalette.test.tsx (131 tests passed)
  • Branch pushed to origin/fix/command-palette-recent-persistence

@drips-wave

drips-wave Bot commented Oct 19, 2026

Copy link
Copy Markdown

@samkelly-dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@thlpkee20-wq
thlpkee20-wq merged commit a092aaa into RevoraOrg:master Oct 22, 2026
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.

fix(command-palette): recent commands persisted to localStorage lose onExecute and do nothing after a reload

2 participants