Skip to content

fix(feedback): Update the feedback list when an item becomes read/unread #91596

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

Closed
wants to merge 1 commit into from

Conversation

ryan953
Copy link
Member

@ryan953 ryan953 commented May 13, 2025

The problem seems to be that, because we're calling useInfiniteQuery the extra 'infinite' string is added to the query key, so we need that in there when we look things up again to mutate the cache.

followup to #86421

@ryan953 ryan953 requested a review from a team as a code owner May 13, 2025 21:56
@ryan953 ryan953 requested a review from billyvg May 13, 2025 21:56
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 13, 2025
@@ -52,7 +52,7 @@ export default function useFetchFeedbackData({feedbackId}: Props) {
if (issueResult.isFetched && issueData && !issueData.hasSeen) {
markAsRead(true);
}
}, [issueResult.isFetched]); // eslint-disable-line react-hooks/exhaustive-deps
}, [issueData, issueResult.isFetched, markAsRead]);
Copy link
Member Author

Choose a reason for hiding this comment

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

This seemed wrong before. Because we were just looking at isFetched i think if you toggled back and forth between two unread feedbacks (so both are in cache), then we wouldn't re-run the useEffect when the visible feedback changed. We want to re-run it in case something else has flipped the hasSeen bit and we want to reset it.

@billyvg
Copy link
Member

billyvg commented May 14, 2025

closing in favor of #91601

@billyvg billyvg closed this May 14, 2025
ryan953 added a commit that referenced this pull request May 14, 2025
…, not create them (#91601)

What was previously happening since
#86421 is that we would silently
change the queryKey that was passed into `useInfiniteApiQuery` to have
`'infinite'` suffixed to the end. This was leaky if any code wanted to
interact with the query cache it had to add the same suffix.

Well, now the suffix is a prefix, and is required when you call
`useInfiniteApiQuery()`. This will ensure that all queryKeys for
useInfiniteApiQuery are unique (as we did before) but also will make
sure that the same queryKey will work for fetching the data and
interacting with the cache.

Replaces #91596
Followup to #86421
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants