Skip to content

docs: warn about isPersisted vs isPersisted.promise footgun#1322

Open
Danny-Devs wants to merge 1 commit intoTanStack:mainfrom
Danny-Devs:docs/warn-ispersisted-footgun
Open

docs: warn about isPersisted vs isPersisted.promise footgun#1322
Danny-Devs wants to merge 1 commit intoTanStack:mainfrom
Danny-Devs:docs/warn-ispersisted-footgun

Conversation

@Danny-Devs
Copy link

Adds an IMPORTANT callout to the Transaction States section warning that await tx.isPersisted silently resolves immediately because Deferred is not a thenable. Users must use tx.isPersisted.promise.

This is a real-world bug we hit in production. TypeScript does not flag it because await accepts any. The consequence is that forms clear, navigation fires, and success messages display before the server confirms the write — and if the server rejects, the rollback happens silently with no error handling.

Context:

  • Deferred<T> (defined in src/deferred.ts) has no .then() method
  • await nonThenable resolves to the value itself per the JS spec
  • Every doc example already uses .promise correctly, but there's no explicit warning about omitting it

@changeset-bot
Copy link

changeset-bot bot commented Mar 3, 2026

⚠️ No Changeset found

Latest commit: 9e51a6e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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