Skip to content
Source
Sign inSign up
TanStack/store

Store: prevState property removed in 0.9.0 (breaking change for tanstack form fields) #296

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

Describe the bug

Hello, I realize that this is still pre-release so maybe this is to be ignored, but wanted to document the change just in case others also ran into this because it seems to have changed the api in tanstack/form since its fieldApi exposes this store.

This PR (0.9.0) removed a previously available public property on the store called prevState which was exposed on fields stores in tanstack form which means I think that this was an unintentional breaking change for tanstack form.

I think this means people relying on this will need to pin to an older version of store or will need to find another way to get the previous value.

Steps to Reproduce the Bug or Issue

Prior to the 0.9.0 release of tanstack/store you could do something like this in tanstack/form

fieldApi.store.prevState?.value

but now prevState is gone

Expected behavior

I expect to continue to be able to use the api so long as I am on the same major version of tanstack/form.

Screenshots or Videos

The change in this PR seems to have removed prevState despite it being exposed publicly (and previously and thus in tanstack form as well).

Image

Platform

  • OS: Any
  • Browser: Any

Additional context

No response

  1. Apologies you've ran into this. Transparently, prevState should have been never exposed in the first place. It was a known incidental side effect of how the hacky innards of Store worked in the past.

    I would have marked it private, but couldn't because:

    1. JS has issues with spreading private properties
    2. Other code has to access that value

    We likely should have removed the documented property using @private as a result. I hadn't considered that anyone would try to use this.

    I think a wrapper atom should be fairly easy to implement in user-land depending on your needs, but transparently this was bad API design on this project (my fault) and I think it would be a bad idea to bring it back.

    Form itself is stable, including documented Store APIs referenced in it - but Store itself always has been an alpha release.

Sign in to join this conversation.