Git Product home page Git Product logo

Comments (7)

oallouch avatar oallouch commented on May 28, 2024 13

same issue here

from react-final-form-arrays.

manzoorwanijk avatar manzoorwanijk commented on May 28, 2024 5

Any update on this?
The performance is very poor with field array. I removed all the fields except the array field (with just two sub fields) and it is still the same.

from react-final-form-arrays.

tjb042 avatar tjb042 commented on May 28, 2024 5

The project I'm working on has some large forms with dynamically generated nested field arrays so I figured I'd throw my experience out there in case it helps others. We were able to signifcantly improve overall form performance by setting the subscription and validateField props on appropriate elements. Out of the box final-form can re-render the form and individual fields a lot. That usually isn't a problem until you add arrays, nesting, or a lot of fields.

A couple of quick examples:

  • Setting the subscription prop on the Form can significantly reduce the number of form-level re-renders. Try to set the subscription scope as narrow as possible. <Form subscription={{ submitting: true }}>
    See: final form subscription example
  • Setting the validateField props on most fields was highly effective for us because it cuts down on cross-field validation and in the vast majority of cases validating a single field does not require the immediate validation of another. <Field name="name" validateFields={[]}>
    See: validateFields
  • Adding memoization of components rendered inside a FieldArray helps prevent useless rendering of array children (and the cascading effect if you have nested arrays)
  • Some of our team members had a misunderstanding of how the Field component prop worked and were passing inline functions to them. The component prop is using React.createElement under the hood and causes this to be recreated on every render which is obviously very expensive. Switching most Field definitions to use children was beneficial here.

from react-final-form-arrays.

panfiva avatar panfiva commented on May 28, 2024 3

The issue has not yet been fixed (final-form-arrays-3.0.2 and react-final-form-arrays-3.1.1). The way I was able to work-around the issue is to use React.Memo to memorize the component to reduce re-rendering (props only included values that were used in rendering of ExpantionPannel

const Test3 = React.memo((props)=> {
    const classes = useStylesExpantionPanel();
    return (<React.Fragment>
        <ExpansionPanel>
          <ExpansionPanelSummary  expandIcon={<ExpandMoreIcon />} >
            <Typography className={classes.heading}>Title</Typography>
          </ExpansionPanelSummary>
          <ExpansionPanelDetails>
            <TextInput source={`${props.source}.minWidth`} label="Min width" resettable />
            <TextInput source={`${props.source}.maxWidth`}  label="Max width" resettable />
            <TextInput source={`${props.source}.minHeight`} label="Min height" resettable />
            <TextInput source={`${props.source}.maxHeight`}  label="Max height" resettable />
            <TextInput source={`${props.source}.width`} label="Width" resettable />
            <TextInput source={`${props.source}.height`} label="Height" resettable />
          </ExpansionPanelDetails>

        </ExpansionPanel>
      </React.Fragment>
    );
  },
  (prevProps, nextProps)=> {console.log({prevProps, nextProps}); return _.isEqual(prevProps, nextProps)}
)

This way, when other form control are updated using user input, no re-rendering is taking place since this form is not re-rendered.

from react-final-form-arrays.

erikras avatar erikras commented on May 28, 2024

Hmm.. I hated adding that setTimeout in #4, but I didn't see any other way around the problem in final-form/final-form#26.

Perhaps it will have to be revisited and thought about some more. 🤔

from react-final-form-arrays.

tlenclos avatar tlenclos commented on May 28, 2024

Having a big performance issue also, at least 1 second to render on input. Tried with 50 fields in my array, and each field is composed of 2 text inputs and some styled components.

Perf profile is pointing to https://github.com/final-form/react-final-form-arrays/blob/master/src/FieldArray.js#L127
(download here https://transfer.sh/xtamd/Profile-20181221T152943)

Do you have any recommendations ? How could I avoid re-rendering the whole list on user input ?

from react-final-form-arrays.

chrismclarke avatar chrismclarke commented on May 28, 2024

Yes I'm trying to used posed animations and it's really bad... A list with 3 items and only a couple field still has 2+ seconds or delays and blocking

from react-final-form-arrays.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.