Skip to content
Source
Sign inSign up
TanStack/form

form.store.subscribe changed type signature #2146

Closedmark1yan0(GitHub profile, opens in a new tab) opened this issue 1 comment

Describe the bug

There's an issue when upgrading the package to v1.29.1 where form.store.subscribe() changed its signature and throws validtion errors. Here's an example

src/components/NewForm/Form.tsx:96:49 - error TS2339: Property 'currentVal' does not exist on type 'FormState<any, any, any, any, any, any, any, any, any, any, any>'.

96     const unsubscribe = form.store.subscribe(({ currentVal }) => {
                                                   ~~~~~~~~~~

src/components/NewForm/Form.tsx:103:18 - error TS2349: This expression is not callable.
  Type 'Subscription' has no call signatures.

103     return () => unsubscribe()
                     ~~~~~~~~~~~

Also no currentVal and prevVal are exposed in the callaback.

Is this api change intentional? If so, its not documented anywhere (or at least I did not found it)

Your minimal, reproducible example

https://codesandbox.io/p/sandbox/fgfrj5

Steps to reproduce

Upgrade the package to the latest version

Expected behavior

form.store.subscribe() should maintain the same signature as before so that currentVal and prevVal are available and also the unsubscribtion fn.

How often does this bug happen?

Only once

Screenshots or Videos

No response

Platform

Development with react

TanStack Form adapter

react-form

TanStack Form version

v1.29.1

TypeScript version

v6.0.3

Additional context

No response

  1. I worry that you've ran into something that we can't fix for you.

    For context, we saw massive performance gains by upgrade TanStack Store to 0.9, which was a major breaking change for that library. This makes sense for Store, since it was in alpha.

    This is why we never documented any other usage of form.store and other Store usage in Form besides useStore. You'll have to follow our migration guide for TanStack Store 0.9 to upgrade to the new APIs there:

    https://github.com/TanStack/store/releases/tag/%40tanstack%2Fstore%400.9.0

Sign in to join this conversation.