Skip to content

ref(tsc): issues endpoint to apiOptions#113525

Open
TkDodo wants to merge 8 commits intomasterfrom
tkdodo/ref/issues-group-list-to-apiOptions
Open

ref(tsc): issues endpoint to apiOptions#113525
TkDodo wants to merge 8 commits intomasterfrom
tkdodo/ref/issues-group-list-to-apiOptions

Conversation

@TkDodo
Copy link
Copy Markdown
Collaborator

@TkDodo TkDodo commented Apr 21, 2026

No description provided.

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 21, 2026
Comment on lines +51 to +60
* Defaults to path '/organizations/$organizationIdOrSlug/issues/'
*/
endpointPath?: string;
endpoint?:
| {
path: '/organizations/$organizationIdOrSlug/issues/';
}
| {
path: '/organizations/$organizationIdOrSlug/releases/$version/resolved/';
version: string;
};
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.

note: passing raw paths in is impossible with apiOptions. There are only 2 urls that should be requested so I’ve made a union type of objects out of which we can internally create apiOptions.

I would’ve passed in full apiOptions from the call-sides but queryParams are computed here and extracting that is even more complicated


<TableWrapper>
<GroupList
endpointPath={path}
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.

removed because that’s just the default value that doesn’t need to be passed

pageLinks: responsePageLinks,
rawData: finalRawData,
};
})();
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.

not sure why we had an IIFE here, pretty pointless imo, so removed.

enabled,
retry: hasQueueFeature
? false
: (failureCount, error) => {
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.

we also get type inference back for retry

Comment on lines +86 to +92
export function useFeedbackApiOptions() {
const context = useContext(FeedbackApiOptionsProvider);

if (!context) {
throw new Error(
'useFeedbackApiOptions must be used within a FeedbackApiOptionsProvider'
);
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.

note: we only ever read from this context when underneath a provider. having an “empty default context” not only hides mistakes when forgetting the provider, it also makes it hard to work with, as apiOptions can’t easily be undefined

now we init the context with null and error out if the Provider is missing, making the mistake explicit and all the usages of the context easier to reason about.

Comment on lines +95 to +101
return apiOptions.asInfinite<FeedbackIssueListItem[]>()(
'/organizations/$organizationIdOrSlug/issues/',
{
path: fixedQueryView ? {organizationIdOrSlug: orgSlug} : skipToken,
query: fixedQueryView ? buildQuery({fixedQueryView, mailbox, prefetch}) : undefined,
staleTime: 0,
}
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.

note: we previously returned undefined here when fixedQueryView was not defined. Working with undefined queryOptions is hard though, so disabling it with skipToken feels like the better approach.

@TkDodo TkDodo marked this pull request as ready for review April 21, 2026 12:28
@TkDodo TkDodo requested review from a team as code owners April 21, 2026 12:28
@TkDodo TkDodo requested a review from a team April 21, 2026 12:39
@TkDodo
Copy link
Copy Markdown
Collaborator Author

TkDodo commented Apr 22, 2026

bugbot run

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 8c06905. Configure here.

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