Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(web): restore Reviews header close button and PR notifications (#7062)

dev-rb8176216c37c7
diff --git a/apps/web/src/features/reviews-view/components/ReviewsList.tsx b/apps/web/src/features/reviews-view/components/ReviewsList.tsx
index 4ecb87fee9..9a9b287850 100644
--- a/apps/web/src/features/reviews-view/components/ReviewsList.tsx
+++ b/apps/web/src/features/reviews-view/components/ReviewsList.tsx
@@ -339,7 +339,6 @@ export function ReviewsList(props: ReviewsListProps) {
}
>
<ListLayoutProvider ref={listElement}>
- {/* virtua can briefly render an old index while the list shrinks. */}
<Virtualizer
as={ReviewListElement}
item="li"
@@ -353,54 +352,46 @@ export function ReviewsList(props: ReviewsListProps) {
itemSize={48}
onScroll={checkNearEnd}
>
- {(candidate: GithubPullRequestEntity | undefined) => (
- <Show when={candidate} keyed>
- {(review) => (
- <ReviewRow
- review={review}
- checked={list.selection.isSelected(review.id)}
- authorDisplayName={
- isAuthoredBy(
- review,
- props.authorLogin,
- props.authorId
- )
- ? props.viewerName
- : undefined
- }
- favoriteAction={favoriteAction}
- onOpen={props.onOpen}
- onChecked={(checked, shiftKey) =>
- listInteractions.selection.set(
- review.id,
- checked,
- {
- range: shiftKey,
- }
- )
- }
- onFocus={() =>
- list.focus.set(review.id, { reason: 'pointer' })
- }
- onClick={(event) => {
- if (event.metaKey || event.ctrlKey) {
- listInteractions.selection.toggle(review.id);
- return;
- }
- list.activate.key(review.id, {
- reason: 'pointer',
- metadata: { newSplit: event.shiftKey },
- });
- }}
- onActivate={(newSplit) =>
- list.activate.key(review.id, {
- reason: 'keyboard',
- metadata: { newSplit },
- })
- }
- />
- )}
- </Show>
+ {(review) => (
+ <ReviewRow
+ review={review}
+ checked={list.selection.isSelected(review.id)}
+ authorDisplayName={
+ isAuthoredBy(
+ review,
+ props.authorLogin,
+ props.authorId
+ )
+ ? props.viewerName
+ : undefined
+ }
+ favoriteAction={favoriteAction}
+ onOpen={props.onOpen}
+ onChecked={(checked, shiftKey) =>
+ listInteractions.selection.set(review.id, checked, {
+ range: shiftKey,
+ })
+ }
+ onFocus={() =>
+ list.focus.set(review.id, { reason: 'pointer' })
+ }
+ onClick={(event) => {
+ if (event.metaKey || event.ctrlKey) {
+ listInteractions.selection.toggle(review.id);
+ return;
+ }
+ list.activate.key(review.id, {
+ reason: 'pointer',
+ metadata: { newSplit: event.shiftKey },
+ });
+ }}
+ onActivate={(newSplit) =>
+ list.activate.key(review.id, {
+ reason: 'keyboard',
+ metadata: { newSplit },
+ })
+ }
+ />
)}
</Virtualizer>
</ListLayoutProvider>
diff --git a/apps/web/src/features/reviews-view/components/ReviewsSidebar.tsx b/apps/web/src/features/reviews-view/components/ReviewsSidebar.tsx
index 5a72681e73..fe6bd0ea5d 100644
--- a/apps/web/src/features/reviews-view/components/ReviewsSidebar.tsx
+++ b/apps/web/src/features/reviews-view/components/ReviewsSidebar.tsx
@@ -153,7 +153,10 @@ export function ReviewsSidebar(props: {
return (
<ViewSidebar.Root aria-label="Reviews navigation">
<ViewSidebar.Header>
- <ViewSidebar.Title>Reviews</ViewSidebar.Title>
+ <div class="flex min-w-0 items-center gap-1">
+ <ViewSidebar.CloseButton />
+ <ViewSidebar.Title>Reviews</ViewSidebar.Title>
+ </div>
</ViewSidebar.Header>
<ViewSidebar.Content>
<ViewSidebar.Nav aria-label="Pull request views">
diff --git a/apps/web/src/features/reviews-view/queries/use-reviews-query.test.ts b/apps/web/src/features/reviews-view/queries/use-reviews-query.test.ts
index ec0443e3e6..b26153a007 100644
--- a/apps/web/src/features/reviews-view/queries/use-reviews-query.test.ts
+++ b/apps/web/src/features/reviews-view/queries/use-reviews-query.test.ts
@@ -1,7 +1,24 @@
+import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
+import type { GithubPullRequestEntity, Notification } from '@entity';
+import { unreadFilterFn } from '@entity/utils/filter';
+import type { NotificationSource } from '@notifications/notification-source';
+import {
+ type SoupAstItemsQuery,
+ useSoupAstItemsQuery,
+} from '@queries/soup/items';
import { describe, expect, it, vi } from 'vitest';
-import { reviewsQueryBody } from './use-reviews-query';
+import { reviewsQueryBody, useReviewsQuery } from './use-reviews-query';
-// Soup query imports websocket clients that cannot connect in jsdom.
+vi.mock('@components/app/GlobalAppState', async (importOriginal) => ({
+ ...(await importOriginal<typeof import('@components/app/GlobalAppState')>()),
+ useGlobalNotificationSource: vi.fn(),
+}));
+vi.mock('@queries/soup/items', async (importOriginal) => ({
+ ...(await importOriginal<typeof import('@queries/soup/items')>()),
+ useSoupAstItemsQuery: vi.fn(),
+}));
+
+// Feature imports can reach websocket clients that cannot connect in jsdom.
vi.mock('@service-storage/websocket', () => ({
storageWS: { reconnectIfDisconnected: vi.fn() },
createWebSocketJob: vi.fn(),
@@ -29,3 +46,90 @@ describe('Reviews Soup filter', () => {
});
});
});
+
+describe('Reviews notifications', () => {
+ it('adapts GraphQL item notifications and applies local overrides', () => {
+ const notification: Notification = {
+ id: 'notification-1',
+ entity_id: 'pr-1',
+ entity_type: 'foreign_entity',
+ notification_event_type: 'github_pr_status_changed',
+ notification_metadata: {
+ tag: 'github_pr_status_changed',
+ content: {
+ displayName: 'Review',
+ foreignEntityId: 'pr-1',
+ githubKey: 'macro/repo/pull/1',
+ number: 1,
+ owner: 'macro',
+ repo: 'repo',
+ title: 'Review',
+ url: 'https://github.com/macro/repo/pull/1',
+ action: 'opened',
+ status: 'open',
+ },
+ },
+ sent: true,
+ state: 'unseen',
+ created_at: '2026-09-11T00:00:00Z',
+ updated_at: '2026-09-11T00:00:00Z',
+ };
+ const review: GithubPullRequestEntity & { notifications: Notification[] } =
+ {
+ type: 'foreign',
+ id: 'pr-1',
+ name: 'Review',
+ ownerId: 'macro|[email protected]',
+ foreignSource: 'github_pull_request',
+ foreignId: 'macro/repo/pull/1',
+ storedForId: 'macro|[email protected]',
+ storedForAuthEntity: 'macro',
+ metadata: {
+ number: 1,
+ name: 'Review',
+ owner: 'macro',
+ repo: 'repo',
+ url: 'https://github.com/macro/repo/pull/1',
+ status: 'open',
+ additions: 0,
+ deletions: 0,
+ comments: [],
+ checks: [],
+ },
+ notifications: [notification],
+ };
+ vi.mocked(useGlobalNotificationSource).mockReturnValue({
+ notificationsByEntity: () => ({}),
+ withLocalOverrides: (item: Notification) => ({
+ ...item,
+ state: 'seen' as const,
+ }),
+ } as NotificationSource);
+ vi.mocked(useSoupAstItemsQuery).mockReturnValue({
+ data: { entities: [review], groups: undefined },
+ error: null,
+ isLoading: false,
+ isFetching: false,
+ isPlaceholderData: false,
+ isFetchingNextPage: false,
+ isEnabled: true,
+ hasNextPage: false,
+ transport: 'graphql',
+ fetchNextPage: vi.fn(),
+ refetch: vi.fn(),
+ resetToInitialPage: vi.fn(),
+ refresh: vi.fn(),
+ } satisfies SoupAstItemsQuery);
+
+ const entity = useReviewsQuery(
+ () => 'updated_at',
+ () => 'involving',
+ () => true
+ ).reviews()[0];
+ if (!entity) throw new Error('Missing review');
+ expect(entity.notifications?.()).toEqual([
+ { ...notification, state: 'seen' },
+ ]);
+ expect(unreadFilterFn(entity)).toBe(false);
+ });
+});
diff --git a/apps/web/src/features/reviews-view/queries/use-reviews-query.ts b/apps/web/src/features/reviews-view/queries/use-reviews-query.ts
index 044a66e5b6..583b56bbb9 100644
--- a/apps/web/src/features/reviews-view/queries/use-reviews-query.ts
+++ b/apps/web/src/features/reviews-view/queries/use-reviews-query.ts
@@ -1,5 +1,7 @@
+import { withEntityNotifications } from '@app/features/soup/entity-notifications';
import { clause, compileClause, confine } from '@app/features/soup/filters';
-import { type GithubPullRequestEntity, isGithubPrEntity } from '@entity';
+import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
+import { isGithubPrEntity } from '@entity';
import { useSoupAstItemsQuery } from '@queries/soup/items';
import type { Accessor } from 'solid-js';
import type { ReviewsScope, ReviewsSortId } from '../reviews-types';
@@ -24,6 +26,7 @@ export function useReviewsQuery(
scope: Accessor<ReviewsScope>,
enabled: Accessor<boolean>
) {
+ const notificationSource = useGlobalNotificationSource();
const query = useSoupAstItemsQuery(
() => ({
params: {
@@ -37,9 +40,11 @@ export function useReviewsQuery(
() => ({ enabled: enabled(), showSupportedForeignEntities: true })
);
- const reviews = (): GithubPullRequestEntity[] => {
+ const reviews = () => {
if (!query.isEnabled || query.isLoading) return [];
- return (query.data?.entities ?? []).filter(isGithubPrEntity);
+ return (query.data?.entities ?? [])
+ .filter(isGithubPrEntity)
+ .map((entity) => withEntityNotifications(entity, notificationSource));
};
return {
reviews,