kettanaito / react-advanced-form

Functional reactive forms. Multi-layer validation, custom styling, field grouping, reactive props, and much more.

Home Page:https://redd.gitbook.io/react-advanced-form

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

setValues: RangeError: Maximum call stack size exceeded

kettanaito opened this issue · comments

Environment

  • react-advanaced-form: 1.5.7

What

Current behavior

Calling formRef.setValues() for a certain forms results into max call stack size exceeded exception.

Uncaught (in promise) RangeError: Maximum call stack size exceeded
    at Arguments.slice (<anonymous>)
    at eval (index.development.js:3257)
    at f2 (index.development.js:3106)
    at eval (index.development.js:4589)
    at f1 (index.development.js:3063)
    at createLeavesGetter (index.development.js:11329)
    at eval (index.development.js:11342)
    at eval (index.development.js:3218)
    at eval (index.development.js:2842)
    at when (index.development.js:6135)
    at eval (index.development.js:3152)
    at f1 (index.development.js:3063)
    at _map (index.development.js:3911)
    at map (index.development.js:4666)
    at eval (index.development.js:3272)
    at f2 (index.development.js:3106)

Expected behavior

Calling formRef.setValues() must be safe, and have no memory leaks.

Why

I think that the algorithm is being caught in the infinite loop during this iteration:

this.validate((fieldProps) => {

Eliminated the infinite loop by reducing the amount of iterations happening in Form.setValues (78f1cae). Relative field validation is applied as a part of fields evolving.