Skip to content

Improved hydration when using network-only, cache-and-network, and no-cache fetch policies#89

Open
jerelmiller wants to merge 22 commits intomainfrom
jerel/improved-hydration
Open

Improved hydration when using network-only, cache-and-network, and no-cache fetch policies#89
jerelmiller wants to merge 22 commits intomainfrom
jerel/improved-hydration

Conversation

@jerelmiller
Copy link
Member

When using fetch policies that bypassed the cache and went to the network, these queries would execute a redundant fetch using the execute tool call. This PR removes that redundancy and will instead serve the tool result that initiated the app the first time the query is executed. After the initial result is served, the fetch policy is honored going forward.

@jerelmiller jerelmiller requested a review from a team as a code owner March 19, 2026 06:31
@github-actions
Copy link
Contributor

github-actions bot commented Mar 19, 2026

Changeset file added - thank you!

setupFiles: ["./vitest-setup.ts"],
mockReset: true,
unstubGlobals: true,
tags: [
Copy link
Member Author

Choose a reason for hiding this comment

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

When developing locally, I noticed several of the vite plugin tests that were flaky due to timeout issues. tags were added as a feature in 4.1.0. I've defined them here so we can use them locally and/or commit tests with tags when we need to bump the timeout or have a test retry due to flakiness.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do we want @prefetch queries to be hydrated queries, or should these just be written to the cache and thats it? If a @prefetch query is marked as network-only for example, should it be fetched again, or should it go through the hydration flow the first time?

@andrewmcgivery would love your thoughts here. Perhaps this rolls into a broader discussion of @prefetch 🙂

@jerelmiller jerelmiller force-pushed the jerel/improved-hydration branch from 094b309 to 05c8a64 Compare March 23, 2026 23:41
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.

1 participant