Skip to content

feat(sidebar): wire tag rename + delete actions - #238

Merged
h4yfans merged 1 commit into
mainfrom
debt/phase-5.2-tag-rename-delete
Apr 16, 2026
Merged

feat(sidebar): wire tag rename + delete actions#238
h4yfans merged 1 commit into
mainfrom
debt/phase-5.2-tag-rename-delete

Conversation

@h4yfans

@h4yfans h4yfans commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Part of Phase 5 (UI stubs + polish) in the tech-debt-remediation plan — see .claude/plans/tech-debt-remediation.md § 5.2.

Closes three TODOs in apps/desktop/src/renderer/src/components/sidebar/tag-detail-view.tsx (lines 319, 324, 348).

New components

  • tag-rename-dialog.tsx — controlled shadcn Dialog with prefilled input, submit-locked while in-flight, calls tagsService.renameTag({ oldName, newName }).
  • tag-delete-dialog.tsx — shadcn AlertDialog with confirmation copy clarifying that notes are untagged, not deleted. Calls tagsService.deleteTag(tag).

Wiring changes

  • TagOverflowMenu now opens each dialog on its respective menu item.
  • On success/failure: toast.success / toast.error using the existing extractErrorMessage helper.
  • Subscribes to onTagRenamed and onTagDeleted events so the detail view re-fetches after a mutation.

Tests

  • tag-detail-view.test.tsx (vitest + RTL): mocks tagsService, asserts menu entries open the correct dialog, dialogs call the right service method with correct args, and toasts fire on both paths.
  • tests/e2e/tags-rename-delete.e2e.ts (Playwright): seeds a note with a tag, drives the rename + delete flow through the real Electron UI, asserts sidebar state after each mutation.

Test plan

  • pnpm exec tsc -p tsconfig.web.json --noEmit clean in the worktree
  • CI: pnpm test --filter @memry/desktop green on tag-detail-view tests
  • CI: pnpm test:e2e --grep tags-rename-delete green against a built bundle
  • Manual smoke: create note with tag, open sidebar tag detail, Rename + Delete flows

Phase 5.2 (ref .claude/plans/tech-debt-remediation.md § 5.2).

- TagRenameDialog: controlled shadcn Dialog with prefilled input, loading
  state on submit, calls tagsService.renameTag + success/error toasts.
- TagDeleteDialog: AlertDialog with confirmation copy explaining notes are
  untagged (not deleted), calls tagsService.deleteTag + toasts.
- Wires both into TagOverflowMenu in tag-detail-view.tsx, replacing the
  three TODOs.
- Subscribes to onTagRenamed / onTagDeleted so cached detail views invalidate
  after mutations.
- Uses the existing extractErrorMessage + sonner toast pattern already in
  the file.
- Tests: tag-detail-view.test.tsx (vitest + RTL) covers the menu wiring +
  dialog callbacks; tags-rename-delete.e2e.ts drives the full flow through
  Electron.
@h4yfans
h4yfans merged commit 23b882f into main Apr 16, 2026
2 checks passed
h4yfans added a commit that referenced this pull request Apr 17, 2026
…g selectors

Three compounding bugs kept this suite red since it was added in #238:

1. createNote() never emitted notes:tags-changed, so the sidebar tag tree
   (subscribed via useNoteTagsQuery) didn't refetch when a tagged note was
   created via API. Mirrors the existing emission in updateNote().

2. The test selector aside button:has-text(...) targeted an <aside> element
   that doesn't exist; the main sidebar is a <div>. Replaced with
   getByRole('button', { name: tag, exact: true }).

3. The Tags sidebar section is defaultExpanded={false}, so even with the
   tag rendered it wasn't visible. Added expandTagsSection() helper that
   toggles via aria-label="Tags section, collapsed".
h4yfans added a commit that referenced this pull request May 6, 2026
Phase 5.2 (ref .claude/plans/tech-debt-remediation.md § 5.2).

- TagRenameDialog: controlled shadcn Dialog with prefilled input, loading
  state on submit, calls tagsService.renameTag + success/error toasts.
- TagDeleteDialog: AlertDialog with confirmation copy explaining notes are
  untagged (not deleted), calls tagsService.deleteTag + toasts.
- Wires both into TagOverflowMenu in tag-detail-view.tsx, replacing the
  three TODOs.
- Subscribes to onTagRenamed / onTagDeleted so cached detail views invalidate
  after mutations.
- Uses the existing extractErrorMessage + sonner toast pattern already in
  the file.
- Tests: tag-detail-view.test.tsx (vitest + RTL) covers the menu wiring +
  dialog callbacks; tags-rename-delete.e2e.ts drives the full flow through
  Electron.
@h4yfans
h4yfans deleted the debt/phase-5.2-tag-rename-delete branch May 6, 2026 16:36
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