Repository navigation
fix(tanstack-table): build atom options only when a comparator exists - #953
Merged
Merged
Conversation
The reactivity bindings passed `{ compare: options?.compare }` into
`createAtom` for every atom, including those table-core creates without a
comparator. `AtomOptions.compare` is optional without `undefined`, so under
`exactOptionalPropertyTypes` that object is not an `AtomOptions`, the second
`createAtom` overload drops out, and `createWritableAtom` is then reported as
returning a `ReadonlyAtom` that cannot satisfy `TableReactivityBindings`.
The package publishes `src/`, so that flag belongs to the consumer. The options
object is now built only when there is a comparator to put in it; `createAtom`
reads `options?.compare ?? Object.is`, so the atoms are unchanged.
WebEferen
marked this pull request as ready for review
September 4, 2026 16:26
WebEferen
marked this pull request as draft
September 4, 2026 16:33
trueadm
marked this pull request as ready for review
September 5, 2026 17:26
14 of 21 tasks
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.
Summary
@octanejs/tanstack-tablepublishessrc/, so the consumer'stsccompiles it with the consumer's flags. UnderexactOptionalPropertyTypesthe package does not build:The bindings forwarded
{ compare: options?.compare }for every atom, including the ones table-core creates without a comparator.AtomOptions.compareis optional withoutundefined, so that object is not anAtomOptionsunder the flag. The second error is the interesting one: the options mismatch knocks outcreateAtom's writable overload, socreateWritableAtomgets reported as returning aReadonlyAtomand stops satisfyingTableReactivityBindings.The options object is now built only when there is a comparator to put in it.
createAtomreadsoptions?.compare ?? Object.is, so an omitted object and one holdingundefinedproduce the same atom, anddebugNamewas already being dropped before this change.Found while building an Octane app with
exactOptionalPropertyTypeson. It was shipping apnpm patchagainst the published tarball; this is the same fix upstream.Validation
Repo-wide
pnpm typecheckandpnpm testwere not run.pnpm format:checkpnpm typecheckpnpm testtsrx-tsc -p packages/tanstack-table/tsconfig.json,tsrx-tsc -p scripts/consumer-tsconfigs/tanstack-table.json,vitest run --project "*tanstack-table*"(9 files, 44 tests)scripts/consumer-tsconfigs/tanstack-table.jsonplusexactOptionalPropertyTypesandnoUncheckedIndexedAccessreports the errors above before the change and nothing from this package after itRisk / follow-ups
No gate covers this.
scripts/consumer-tsconfigs/base.jsonmirrors whatoctane initscaffolds, which leaves both flags off, and turning them on in a package tsconfig pullspackages/octane/srcinto the program, where the same classes of error exist in bulk. A real consumer never sees those, becauseoctanepublishesdistwith declarations behindskipLibCheck, while every@octanejs/*binding publishes source. The header ofscripts/generate-consumer-tsconfigs.mjsalready records that debt against #721; widening those projects is worth doing once core is clean.Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Low Risk
Narrow typing fix in atom option forwarding; runtime atom behavior is unchanged when no comparator is supplied.
Overview
Fixes a TypeScript build failure for apps that compile
@octanejs/tanstack-tablefrom publishedsrc/withexactOptionalPropertyTypes.The reactivity bindings no longer pass
{ compare: options?.compare }intocreateAtomon every call. A newatomOptionshelper only builds anAtomOptionsobject when table-core actually provides a comparator; otherwisecreateAtomis called with no options (same runtime behavior via its default compare). That restores correct overload resolution socreateWritableAtomtypes as a writable atom again and satisfiesTableReactivityBindings.Patch changeset for
@octanejs/tanstack-table.Reviewed by Cursor Bugbot for commit 3249d5e. Bugbot is set up for automated code reviews on this repo. Configure here.