Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appeals - Remove appeals when switch account list #1196

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/components/Tool/Appeal/InitialPage/Appeals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,11 @@ const Appeals: React.FC<AppealsProps> = ({ accountListId }) => {
))}
</>
) : data?.regularAppeals.nodes.length ? (
<>
{data.regularAppeals.nodes.map((appeal) => (
<Box key={appeal.name} mb={3}>
<Appeal appeal={appeal} changePrimary={handleChangePrimary} />
</Box>
))}
</>
data.regularAppeals.nodes.map((appeal) => (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dr-bizz Do you know why moving it outside of the fragment changes things?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue was the key. At first, it was the appeal's name, which sometimes had duplicates. I switched it to the id, which would be unique.

I don't think removing the fragment did anything apart from simplifying the code (in my opinion). Maybe React read the Fragment as an item and kept it in the render, but that is unlikely.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. I missed that the key changed. That's probably what fixed it.

<Box key={appeal.id} mb={3}>
<Appeal appeal={appeal} changePrimary={handleChangePrimary} />
</Box>
))
) : (
<NoAppeals />
)}
Expand Down
Loading