Skip to content

feat: network request docs overhaul#17644

Open
TkDodo wants to merge 5 commits intomasterfrom
tkdodo/data-fetching
Open

feat: network request docs overhaul#17644
TkDodo wants to merge 5 commits intomasterfrom
tkdodo/data-fetching

Conversation

@TkDodo
Copy link
Copy Markdown
Contributor

@TkDodo TkDodo commented May 6, 2026

DESCRIBE YOUR PR

This PR updates the Network Request section of the developer docs to reflect the current reality.

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.

  • Urgent deadline (GA date, etc.):
  • Other deadline:
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

EXTRA RESOURCES

@vercel
Copy link
Copy Markdown

vercel Bot commented May 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
develop-docs Ready Ready Preview, Comment May 7, 2026 9:52am
sentry-docs Ready Ready Preview, Comment May 7, 2026 9:52am

Request Review

@TkDodo TkDodo marked this pull request as ready for review May 6, 2026 11:06
@TkDodo TkDodo requested a review from a team May 6, 2026 11:07
Comment thread develop-docs/frontend/network-requests.mdx Outdated
Comment thread develop-docs/frontend/network-requests.mdx Outdated
Comment thread develop-docs/frontend/network-requests.mdx
Comment thread develop-docs/frontend/network-requests.mdx
@TkDodo TkDodo requested a review from ryan953 May 7, 2026 09:41
Comment thread develop-docs/frontend/network-requests.mdx
</ul>
The first argument is a URL pattern from a **generated list of known API endpoints**. This list is derived from the backend route definitions and lives in `knownSentryApiUrls.generated.ts` (with a manual companion for getsentry routes in `knownGetsentryApiUrls.ts`). TypeScript restricts the URL to one of these known patterns, so typos and invalid endpoints are caught at compile time.

URL patterns use `$param` placeholders (e.g. `$organizationIdOrSlug`, `$issueId`) which TypeScript extracts to enforce a matching `path` object. If the URL has parameters, you must supply all of them - or pass `skipToken` to disable the query.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
URL patterns use `$param` placeholders (e.g. `$organizationIdOrSlug`, `$issueId`) which TypeScript extracts to enforce a matching `path` object. If the URL has parameters, you must supply all of them - or pass `skipToken` to disable the query.
URL patterns use `$param` placeholders (e.g. `$organizationIdOrSlug`, `$issueId`) which TypeScript extracts to enforce a matching `path` object. If the URL has parameters, you must supply all of them - [or pass `skipToken`](#conditional-fetching-with-skiptoken) to disable the query.

Comment on lines +50 to +53
- `staleTime: 0` — data is always stale; it changes often and I'm okay with excess refetches.
- `staleTime: 30_000` — "I only want to refetch at most every 30 seconds".
- `staleTime: Infinity` — data never goes stale. Use for data that doesn't change (or changes so rarely that you'll invalidate manually).
- `staleTime: 'static'` — data is fetched once and _never_ refetched, even if the Query is invalidated manually.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

epic!

Since the return value of `apiOptions` matches the `QueryFilter` that needs to be passed `invalidateQueries`, you can also pass it directly:

```tsx
queryClient.invalidateQueries(sentryAppApiOptions({ appSlug: "my-app" }));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

tweak to match the example above, call out the differences easier.

Suggested change
queryClient.invalidateQueries(sentryAppApiOptions({ appSlug: "my-app" }));
const opts = sentryAppApiOptions({ appSlug: "my-app" });
queryClient.invalidateQueries(opts);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants