rjsf-team / react-jsonschema-form

A React component for building Web forms from JSON Schema.
https://rjsf-team.github.io/react-jsonschema-form/
Apache License 2.0
14.32k stars 2.19k forks source link

Too much recursion when when inputting lots of decimals in a number field #2233

Closed arime closed 1 year ago

arime commented 3 years ago

Prerequisites

Description

When entering a number with lots of decimals in a number field, something starts recursing a lot and the browser gets stuck. It gets worse when there is small decimals. For example 1.000000000000001 is still fine, but if you start adding more zeros in between, keeping 1 as the last digit, this happens.

The issue can be reproduced in the playground, here's a link:

https://rjsf-team.github.io/react-jsonschema-form/#eyJmb3JtRGF0YSI6eyJmaXJzdE5hbWUiOiJDaHVjayIsImxhc3ROYW1lIjoiTm9ycmlzIiwiYWdlIjo3NSwiYmlvIjoiUm91bmRob3VzZSBraWNraW5nIGFzc2VzIHNpbmNlIDE5NDAiLCJwYXNzd29yZCI6Im5vbmVlZCIsIm51bWJlciI6MS4wMDAwMDAwMDAwMDAwMDF9LCJzY2hlbWEiOnsidGl0bGUiOiJSZXByb2R1Y2luZyB0b28gbXVjaCByZWN1cnNpb24iLCJ0eXBlIjoib2JqZWN0IiwicHJvcGVydGllcyI6eyJudW1iZXIiOnsidHlwZSI6Im51bWJlciJ9fX0sInVpU2NoZW1hIjp7ImZpcnN0TmFtZSI6eyJ1aTphdXRvZm9jdXMiOnRydWUsInVpOmVtcHR5VmFsdWUiOiIiLCJ1aTphdXRvY29tcGxldGUiOiJmYW1pbHktbmFtZSJ9LCJsYXN0TmFtZSI6eyJ1aTplbXB0eVZhbHVlIjoiIiwidWk6YXV0b2NvbXBsZXRlIjoiZ2l2ZW4tbmFtZSJ9LCJhZ2UiOnsidWk6d2lkZ2V0IjoidXBkb3duIiwidWk6dGl0bGUiOiJBZ2Ugb2YgcGVyc29uIiwidWk6ZGVzY3JpcHRpb24iOiIoZWFydGhpYW4geWVhcikifSwiYmlvIjp7InVpOndpZGdldCI6InRleHRhcmVhIn0sInBhc3N3b3JkIjp7InVpOndpZGdldCI6InBhc3N3b3JkIiwidWk6aGVscCI6IkhpbnQ6IE1ha2UgaXQgc3Ryb25nISJ9LCJkYXRlIjp7InVpOndpZGdldCI6ImFsdC1kYXRldGltZSJ9LCJ0ZWxlcGhvbmUiOnsidWk6b3B0aW9ucyI6eyJpbnB1dFR5cGUiOiJ0ZWwifX19LCJ0aGVtZSI6ImRlZmF1bHQiLCJsaXZlU2V0dGluZ3MiOnsidmFsaWRhdGUiOmZhbHNlLCJkaXNhYmxlIjpmYWxzZSwib21pdEV4dHJhRGF0YSI6ZmFsc2UsImxpdmVPbWl0IjpmYWxzZX19

Steps to Reproduce

  1. Define a JSON schema with a number-type field
  2. Generate form out of the schema and enter 1.000000000000001 in the number field
  3. Start adding more zeros in between, while keeping 1 as the last digit

Expected behavior

The app stays responsive and there are no errors.

Actual behavior

The app becomes unresponsive and after some time an "Uncaught InternalError: too much recursion" happens.

Screenshot 2021-02-11 at 13 08 25

Version

2.4.1

arime commented 3 years ago

Screenshot 2021-02-11 at 12 44 48

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please leave a comment if this is still an issue for you. Thank you.