Skip to content

ref(tsc): issue details endpoint to apiOptions#114059

Merged
TkDodo merged 9 commits intomasterfrom
tkdodo/ref/issue-details-to-apiOptions
Apr 28, 2026
Merged

ref(tsc): issue details endpoint to apiOptions#114059
TkDodo merged 9 commits intomasterfrom
tkdodo/ref/issue-details-to-apiOptions

Conversation

@TkDodo
Copy link
Copy Markdown
Collaborator

@TkDodo TkDodo commented Apr 27, 2026

No description provided.

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 27, 2026
@TkDodo TkDodo marked this pull request as ready for review April 27, 2026 17:27
@TkDodo TkDodo requested review from a team as code owners April 27, 2026 17:27
@TkDodo TkDodo requested a review from a team April 27, 2026 17:27
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)!;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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 😅 .

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I’ve removed it 🤷

dade9a7

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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

@TkDodo TkDodo merged commit 866483d into master Apr 28, 2026
65 checks passed
@TkDodo TkDodo deleted the tkdodo/ref/issue-details-to-apiOptions branch April 28, 2026 08:42
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.

3 participants