Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscribe errors with NaN #1348

Open
pedro757 opened this issue Mar 28, 2025 · 0 comments
Open

Subscribe errors with NaN #1348

pedro757 opened this issue Mar 28, 2025 · 0 comments

Comments

@pedro757
Copy link

pedro757 commented Mar 28, 2025

Describe the bug

The library actually works fine but Next.js shows an error in the bottom left corner and It's annoying, functionality is not affected AFAICT.

This only happens when I use NaN as defaultValue and then try to Subscribe to the value, it doesn't when using a empty string, it also works with zero as defaultValue.

What are the general recommendation about defaultValues ?

Image
Image

Call Stack createUnhandledError ../../node_modules/next/src/client/components/errors/console-error.ts (18:35) handleClientError ../../node_modules/next/src/client/components/errors/use-error-handler.ts (31:33) console.error ../../node_modules/next/src/client/components/globals/intercept-console-error.ts (32:26) mountSyncExternalStore ../../node_modules/next/dist/compiled/react-dom/cjs/react-dom-client.development.js (5533:20) Object.useSyncExternalStore ../../node_modules/next/dist/compiled/react-dom/cjs/react-dom-client.development.js (23063:16) exports.useSyncExternalStore ../../node_modules/next/dist/compiled/react/cjs/react.development.js (1231:34) exports.useSyncExternalStoreWithSelector ../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js (82:19) useStore ../../node_modules/@tanstack/react-store/src/index.ts (23:17) LocalSubscribe ../../node_modules/@tanstack/react-form/src/useForm.tsx (132:16) useForm.useState ../../node_modules/@tanstack/react-form/src/useForm.tsx (198:9) MyForm app/example/form.tsx (129:15) Page app/example/page.tsx (28:7)

Your minimal, reproducible example

https://github.com/pedro757/form-subscribe-error-NaN

Steps to reproduce

  1. bun dev
  2. See the error in the bottom left corner

Expected behavior

Not displaying the error

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • OS: Linux
  • Browser: Chromium
  • Browser Version: 134

TanStack Form adapter

react-form

TanStack Form version

v1.1.2 sandbox is latest

TypeScript version

v5.8.2

Additional context

No response

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

No branches or pull requests

1 participant