ref(tsc): issue details endpoint to apiOptions#114059
Merged
Conversation
TkDodo
commented
Apr 27, 2026
Comment on lines
-45
to
+49
| const itemQueryKeyRef = useRef<Map<string, ItemQueryKeys>>(new Map()); | ||
| const getItemQueryKeys = useCallback( | ||
| const itemApiOptionsRef = useRef<Map<string, FeedbackItemApiOptions>>(new Map()); | ||
| const getItemApiOptions = useCallback( | ||
| (feedbackId: string) => { | ||
| if (feedbackId && !itemQueryKeyRef.current.has(feedbackId)) { | ||
| itemQueryKeyRef.current.set( | ||
| if (!itemApiOptionsRef.current.has(feedbackId)) { | ||
| itemApiOptionsRef.current.set( | ||
| feedbackId, | ||
| getFeedbackItemQueryKey({feedbackId, organization}) | ||
| getFeedbackItemApiOptions({feedbackId, organization}) | ||
| ); | ||
| } | ||
| return itemQueryKeyRef.current.get(feedbackId) ?? EMPTY_ITEM_QUERY_KEYS; | ||
| return itemApiOptionsRef.current.get(feedbackId)!; |
Collaborator
Author
There was a problem hiding this comment.
I don’t understand why we even need this ref. Why would we need to store QueryKeys (or now ApiOptions) in a Map? Can’t we just re-create them every time?
getItemOptions could just be:
const getItemApiOptions = useCallback(
(feedbackId: string) => getFeedbackItemApiOptions({feedbackId, organization}),
[organization]
);
The map is not used anywhere else.
@ryan953 tagging you since I think you created this 3 years ago 😅 .
Collaborator
Author
There was a problem hiding this comment.
I’ve removed it 🤷
Collaborator
Author
There was a problem hiding this comment.
okay what it does is it stores per feedbackId even though we need feedbackId and organization. So if organization changes, this still reads from the cache map.
not sure if that is on purpose but I’ve restored it for now, can be cleaned up in a follow up if necessary: 9cdabe7
JonasBa
approved these changes
Apr 27, 2026
scttcper
approved these changes
Apr 27, 2026
This reverts commit dade9a7.
cleptric
pushed a commit
that referenced
this pull request
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.