Skip to content

Commit 67cd4cd

Browse files
amitsingh-007claude
andcommitted
refactor: address review feedback on reuse cleanups
- ContextMenu keys on id rather than text, which can repeat across options - Restore the original branch-per-condition form of getFilteredContextBookmarks; the flattened boolean chain read worse - Trim comments down to the non-obvious reasoning Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent d7a4db7 commit 67cd4cd

5 files changed

Lines changed: 12 additions & 20 deletions

File tree

apps/extension/src/entrypoints/popup/components/ContextMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function ContextMenuWrapper({ options, children }: Props) {
3939
<ContextMenuContent className="min-w-40">
4040
{options.map(({ id, text, icon, variant, onClick }) => (
4141
<ContextMenuItem
42-
key={text}
42+
key={id}
4343
data-testid={`context-menu-item-${id}`}
4444
className="gap-2"
4545
variant={variant}

apps/extension/tests/fixtures/base-fixture.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ interface CachedStorageData {
2222
export const getPopupUrl = (extensionId: string) =>
2323
`chrome-extension://${extensionId}/popup.html`;
2424

25-
/**
26-
* Launch Chromium with the extension loaded. The CI-sensitive flags live here
27-
* only, so they cannot drift between the auth setup and the fixtures.
28-
*/
2925
export const launchExtensionContext = async ({
3026
userDataDir,
3127
extensionPath = getExtensionPath(),
@@ -201,11 +197,7 @@ export interface SharedExtensionWorkerFixtures {
201197
sharedExtensionId: string;
202198
}
203199

204-
/**
205-
* Worker-scoped extension environment shared by every panel fixture: one copied
206-
* Chrome profile, one background service worker, one extension id per worker.
207-
* Panel fixtures extend this and add only their own page fixture.
208-
*/
200+
/** Worker-scoped extension env shared by every panel fixture. */
209201
export const sharedExtensionTest = base.extend<
210202
{ context: BrowserContext },
211203
SharedExtensionWorkerFixtures

apps/web/tests/page-object-models/persons-panel.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ export class PersonsPanel {
9595

9696
async verifyModalVisible() {
9797
await verifyModalVisible(this.page, MODAL_TEST_ID);
98-
// Back button only renders while the modal is open, so it is the stronger
99-
// signal that the modal actually mounted its content
98+
// Back button only renders while the modal is open
10099
const backButton = this.getModal().getByRole('button', { name: 'Back' });
101100
await expect(backButton).toBeVisible();
102101
}

packages/shared/src/components/Bookmarks/utils/index.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ export const getFilteredContextBookmarks = (
1919
contextBookmarks: ContextBookmarks,
2020
searchText: string
2121
) =>
22-
contextBookmarks.filter(
23-
(ctx) =>
24-
!searchText ||
25-
ctx.isDir ||
26-
hasText(searchText, ctx.url) ||
27-
hasText(searchText, ctx.title)
28-
);
22+
contextBookmarks.filter((ctx) => {
23+
if (!searchText) {
24+
return true;
25+
}
26+
if (ctx.isDir) {
27+
return true;
28+
}
29+
return hasText(searchText, ctx.url) || hasText(searchText, ctx.title);
30+
});
2931

3032
export const getEncryptedBookmark = (
3133
bookmark: IEncodedBookmark

packages/shared/src/components/Persons/components/Person.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ interface Props {
1313
function Person({ person }: Props) {
1414
const { location } = use(DynamicContext);
1515
const { uid, name } = person;
16-
// SWR keyed by uid, so grid cells share one resolved blob URL across remounts
1716
const { data: imageUrl = '' } = usePersonImage(uid);
1817

1918
const openBookmarksList = () => {

0 commit comments

Comments
 (0)