feat: add options to close many tabs - #302
Conversation
📝 WalkthroughWalkthroughAdds a Redux ChangesClose Multiple Notes Tabs
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/app/src/state/redux/vaults/__tests__/redux.vault.activeNote.test.ts (1)
10-12: ⚡ Quick winUse a fresh store per test to avoid state leakage.
Line 11 and Line 128 create one shared mutable store per
describe, so state from prior tests can leak (especiallyrecentlyClosedNotes). Prefer creating the store inbeforeEach(or inside each test) for isolation.Suggested refactor
describe('Active note consistency', () => { - const { store, workspaceScope, selectors } = createTestStore(); + let store: ReturnType<typeof createTestStore>['store']; + let workspaceScope: ReturnType<typeof createTestStore>['workspaceScope']; + let selectors: ReturnType<typeof createTestStore>['selectors']; - // Init state - beforeAll(() => { + beforeEach(() => { + ({ store, workspaceScope, selectors } = createTestStore()); store.dispatch( workspacesApi.setOpenedNotes({ ...workspaceScope, notes: [mockNoteObject('1'), mockNoteObject('2'), mockNoteObject('3')], }), ); });describe('Close note tabs via queries', () => { - const { store, workspaceScope, selectors } = createTestStore(); + let store: ReturnType<typeof createTestStore>['store']; + let workspaceScope: ReturnType<typeof createTestStore>['workspaceScope']; + let selectors: ReturnType<typeof createTestStore>['selectors']; beforeEach(() => { + ({ store, workspaceScope, selectors } = createTestStore()); store.dispatch( workspacesApi.setOpenedNotes({ ...workspaceScope,Also applies to: 127-129
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/app/src/state/redux/vaults/__tests__/redux.vault.activeNote.test.ts` around lines 10 - 12, The test suite 'Active note consistency' currently calls createTestStore() once at describe scope producing shared store, workspaceScope, and selectors which allows state leakage across tests (e.g., recentlyClosedNotes); change the setup to initialize these per test by moving const { store, workspaceScope, selectors } = createTestStore() into a beforeEach block (or into each individual it/ test) so each test gets a fresh store instance; update any references to store/workspaceScope/selectors inside tests to use the freshly created variables.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/app/src/state/redux/vaults/vaults.ts`:
- Around line 433-442: Detect and disallow the simultaneous use of
query.afterNoteId and query.beforeNoteId to avoid the conflicting early-return
behavior: add a runtime guard at the start of the vaults filtering routine in
vaults.ts that checks if both query.afterNoteId and query.beforeNoteId are set
and then either throw/log and return (or normalize by clearing one) so the later
per-id logic (the blocks referencing edgesReached.after, edgesReached.before and
excludes.has(id)) never runs with both boundaries active; this keeps the
afterNoteId early-return from bypassing the beforeNoteId logic and prevents
accidental over-closing.
---
Nitpick comments:
In
`@packages/app/src/state/redux/vaults/__tests__/redux.vault.activeNote.test.ts`:
- Around line 10-12: The test suite 'Active note consistency' currently calls
createTestStore() once at describe scope producing shared store, workspaceScope,
and selectors which allows state leakage across tests (e.g.,
recentlyClosedNotes); change the setup to initialize these per test by moving
const { store, workspaceScope, selectors } = createTestStore() into a beforeEach
block (or into each individual it/ test) so each test gets a fresh store
instance; update any references to store/workspaceScope/selectors inside tests
to use the freshly created variables.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: c69c63d5-a744-4667-8b21-4d36b1a7de77
📒 Files selected for processing (7)
packages/app/src/__tests__/utils/redux.tspackages/app/src/features/NotesContainer/NoteContextMenu/index.tspackages/app/src/features/NotesContainer/NoteContextMenu/useNoteContextMenu.tspackages/app/src/features/NotesContainer/OpenedNotesPanel.tsxpackages/app/src/state/redux/vaults/__tests__/redux.vault.activeNote.test.tspackages/app/src/state/redux/vaults/redux-workspace-utils.test.tspackages/app/src/state/redux/vaults/vaults.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/app/src/locales/sl/menu.json`:
- Line 26: The translation string for the move-to-bin action is incorrect for
key "deleteToBin" in the locales file; replace the current value "Prevedi v
smetnjak" with the proper user-facing Slovenian phrase such as "Premakni v koš"
(or "Premakni v smetnjak" if you prefer that wording) in the "deleteToBin" entry
so the UI shows "move to bin/trash" instead of "translate to trash". Ensure only
the string value for "deleteToBin" is changed and keep the JSON formatting
intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 4a5c8522-00cd-477e-8c06-d482587885ec
📒 Files selected for processing (37)
packages/app/src/features/NotesContainer/NoteContextMenu/useNoteContextMenu.tspackages/app/src/locales/ar/menu.jsonpackages/app/src/locales/bg/menu.jsonpackages/app/src/locales/ca/menu.jsonpackages/app/src/locales/cs/menu.jsonpackages/app/src/locales/da/menu.jsonpackages/app/src/locales/de/menu.jsonpackages/app/src/locales/el/menu.jsonpackages/app/src/locales/en/menu.jsonpackages/app/src/locales/es/menu.jsonpackages/app/src/locales/fa/menu.jsonpackages/app/src/locales/fi/menu.jsonpackages/app/src/locales/fr/menu.jsonpackages/app/src/locales/he/menu.jsonpackages/app/src/locales/hi/menu.jsonpackages/app/src/locales/hu/menu.jsonpackages/app/src/locales/id/menu.jsonpackages/app/src/locales/it/menu.jsonpackages/app/src/locales/ja/menu.jsonpackages/app/src/locales/ka/menu.jsonpackages/app/src/locales/ko/menu.jsonpackages/app/src/locales/nb/menu.jsonpackages/app/src/locales/nl/menu.jsonpackages/app/src/locales/pl/menu.jsonpackages/app/src/locales/pt-BR/menu.jsonpackages/app/src/locales/pt-PT/menu.jsonpackages/app/src/locales/ro/menu.jsonpackages/app/src/locales/ru/menu.jsonpackages/app/src/locales/sl/menu.jsonpackages/app/src/locales/sr/menu.jsonpackages/app/src/locales/sv/menu.jsonpackages/app/src/locales/th/menu.jsonpackages/app/src/locales/tr/menu.jsonpackages/app/src/locales/uk/menu.jsonpackages/app/src/locales/vi/menu.jsonpackages/app/src/locales/zh-CN/menu.jsonpackages/app/src/locales/zh-TW/menu.json
✅ Files skipped from review due to trivial changes (20)
- packages/app/src/locales/ar/menu.json
- packages/app/src/locales/it/menu.json
- packages/app/src/locales/es/menu.json
- packages/app/src/locales/de/menu.json
- packages/app/src/locales/ru/menu.json
- packages/app/src/locales/ka/menu.json
- packages/app/src/locales/zh-CN/menu.json
- packages/app/src/locales/ca/menu.json
- packages/app/src/locales/pl/menu.json
- packages/app/src/locales/hu/menu.json
- packages/app/src/locales/hi/menu.json
- packages/app/src/locales/nb/menu.json
- packages/app/src/locales/fi/menu.json
- packages/app/src/locales/he/menu.json
- packages/app/src/locales/uk/menu.json
- packages/app/src/locales/nl/menu.json
- packages/app/src/locales/da/menu.json
- packages/app/src/locales/zh-TW/menu.json
- packages/app/src/locales/pt-PT/menu.json
- packages/app/src/locales/ro/menu.json
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/app/src/features/NotesContainer/NoteContextMenu/useNoteContextMenu.ts
Closes #300
Summary by CodeRabbit
New Features
Tests
Localization