Skip to content

[P0/bug] SaveFavoriteDialog does not validate against duplicate names #332

Closed

Description

@EVWorth

Context

SaveFavoriteDialog.handleSave (src/components/favorites/SaveFavoriteDialog.tsx:39-51) and favoritesStore.addFavorite (src/stores/favoritesStore.ts:80-95) have no dedup check.

Problem

Saving two favorites with the same name creates two entries, both rendering with the same label in the sidebar. The user has to inspect them one by one to delete the duplicate. The store action doesn't dedup either, so the bug is reproducible from any code path.

Files

  • src/components/favorites/SaveFavoriteDialog.tsx:39-51
  • src/stores/favoritesStore.ts:80-95

Expected

Submitting the dialog with a duplicate name shows an inline error and does not close the dialog; the store does not gain a new entry; the existing entry is untouched.

Proposed fix

Scope S — add a getByName(name: string) selector to favoritesStore; in SaveFavoriteDialog.handleSave, do if (store.getByName(name.trim()).length > 0) { showError('A favorite with this name already exists'); return; }. Or change the message to "exists in category X; click here to overwrite" as a smarter UX.

Acceptance

Submitting the dialog with a duplicate name shows an inline error and does not close the dialog; the store does not gain a new entry; the existing entry is untouched.

Needs human verify

no

Activity

  1. added
    audit
    severity/p0
    kind/bug
    area/favorites
    on Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/favoritesauditkind/bugseverity/p0

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions