Home > Enterprise >  Recomputing whole property on value change
Recomputing whole property on value change

Time:01-06

I have an MxN table of input fields with the last column containing a reactive calculation based on every row's data. Rows are independent i.e. data in one row does not affect calculation in another. The reactive calculation results for all rows are stored in a single computed property which is looped over when constructing the table.

This way any change to any input field in the table triggers recomputation of the whole property. At some point this approach is bound to create performance issues.

I am wondering if there is a better general strategy which allows to limit the reactivity to only the relevant fields in such cases.

CodePudding user response:

At some point this approach is bound to create performance issues.

Well maybe. Did you hit that point? If not, it is premature optimization.

If yes, this can be solved by creating an array of computed properties representing the column (each value in an array is computed from specific row)

  • Related