Skip to content

Support for React Compiler #1030

@Axenu

Description

@Axenu

Describe the bug

While using this package in our react project, we needed to access the current value of one of the fields in the form, to use that to update the possible values in another field (select).

The problem is that we have the eslint-plugin-react-compiler plugin, which does not accept the form.useStore hook with the exception "Hooks must be the same function on every render, but this value may change over time to a different function.".

The UI works as expected, but it seems like the way of accessing the current value in a reactive manor is not correct according to the rules for hooks.

I added a fork of this repo, where I have added the eslint plugin. The eslint check of the useForm file fails.

Your minimal, reproducible example

https://github.com/Axenu/tanstack-form/tree/react-compiler

Steps to reproduce

  1. run ppm install
  2. npm run test:eslint

Expected behavior

There should not be any lint errors when using form.useStore

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

MacOS, eslint

TanStack Form adapter

None

TanStack Form version

0.36.2

TypeScript version

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions