Conversation
Contributor
📊 Type Coverage Diff✅ No new type safety issues introduced. Coverage: 93.44% |
…ApiQueryKEy directly, only QueryKeyEndpointOptions
12f2188 to
be936ec
Compare
…ckboxContext hook
TkDodo
reviewed
May 7, 2026
| hits={filteredProjects.length} | ||
| knownIds={filteredProjects.map(project => project.id)} | ||
| queryKey={queryKey} | ||
| queryKey={safeParseQueryKey(queryKey)?.options} |
Collaborator
There was a problem hiding this comment.
I think there’s some more cleanup missing:
- the param here is not
queryKeyanymore - it’sendpointOptions - we’re still constructing a “fake” query key just to safeParse it and pass options from it, but we can just pass options naturally. The
queryKeyis not used anywhere else:
endpointOptions={{query: {query: searchTerm, sort, agent: agentFilter}}
Collaborator
There was a problem hiding this comment.
we already parseQueryKey in line 63:
const {options} = parseQueryKey(queryKey);
const needsSDKUpdateForClickSearch = useNeedsSDKUpdateForClickSearch({
search: options?.query?.query as string | undefined,
});
I think you’d want to change that to safeParseQueryKey too (as we use it as options?.query?.query anyways, it can be undefined), thus getting rid of parseQueryKey here altogether and we’d only parse once not twice.
| const queryOptions = queryKeyRef.current | ||
| ? parseQueryKey(queryKeyRef.current).options | ||
| : undefined; | ||
| const queryOptions = queryKeyRef.current; |
Collaborator
There was a problem hiding this comment.
naming wise this should really be endpointOptions as queryOptions is already a term we use for react-query queryOptions() and it’s quite confusing that this is something different 😅
| const queryOptions = queryKeyRef.current | ||
| ? parseQueryKey(queryKeyRef.current).options | ||
| : undefined; | ||
| const queryOptions = queryKeyRef.current; |
Collaborator
There was a problem hiding this comment.
same naming thought here:
Suggested change
| const queryOptions = queryKeyRef.current; | |
| const endpointOptions = endpointOptionsRef.current; |
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.
This PR has 4 layers to look at
Start with the change to
static/app/utils/list/useListItemCheckboxState.tsxWe've changed from
ApiQueryKey | InfiniteApiQueryKeytoQueryKeyEndpointOptionsand re-wrote it a little to be more concise.Files passing values into useListItemCheckboxState or the Provider.
With the change to
ListCheckboxQueryKeyValueandListCheckboxQueryKeyRefwe need to pass in a different object to the provider.Instead of
queryKey={queryOptions.queryKey}there'squeryKey={safeParseQueryKey(queryOptions.queryKey)?.options}in these 4 files:We also read from the useListItemCheckboxState
When we read from the state hook we need to make sure we're assuming the new object type. That's what these files are updated to do:
Final layer
Along the way I noticed that
ListItemCheckboxProviderwasn't part of the FeedbackList component tree. It was passing props into the hook and doing weird things. So i added the provider, and moved the calls touseListItemCheckboxContextinto the sub-components. I forget the reasons why it wasn't like this before, probably because feedback was the first one and got left behind.