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(reviews): guard transient virtualized rows (#7021)

dev-rb4f2b170a9cf3
diff --git a/apps/web/src/features/reviews-view/components/ReviewsList.tsx b/apps/web/src/features/reviews-view/components/ReviewsList.tsx
index 9a9b287850..4ecb87fee9 100644
--- a/apps/web/src/features/reviews-view/components/ReviewsList.tsx
+++ b/apps/web/src/features/reviews-view/components/ReviewsList.tsx
@@ -339,6 +339,7 @@ export function ReviewsList(props: ReviewsListProps) {
}
>
<ListLayoutProvider ref={listElement}>
+ {/* virtua can briefly render an old index while the list shrinks. */}
<Virtualizer
as={ReviewListElement}
item="li"
@@ -352,46 +353,54 @@ export function ReviewsList(props: ReviewsListProps) {
itemSize={48}
onScroll={checkNearEnd}
>
- {(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 },
- })
- }
- />
+ {(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>
)}
</Virtualizer>
</ListLayoutProvider>