From 74b05a5abae8462266f4eb18355d3f85853ae844 Mon Sep 17 00:00:00 2001 From: karol Date: Wed, 18 Oct 2017 13:35:59 +0200 Subject: [PATCH] Updating state on values lenght change --- src/components/ListField.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/ListField.jsx b/src/components/ListField.jsx index dc6a012..f43f22e 100644 --- a/src/components/ListField.jsx +++ b/src/components/ListField.jsx @@ -30,9 +30,11 @@ export class ListField extends React.Component { } componentWillReceiveProps({ value }) { + const { value: actualValue } = this.props; let shouldSetState = false; value.forEach((item, key) => { - if (!this.state.model[key] || item !== this.state.model[key].value) shouldSetState = true; + if (!this.state.model[key] || item !== this.state.model[key].value || actualValue.length !== value.length) + shouldSetState = true; }); if (shouldSetState) this.storage.setModel(this.getModelFromProps({ value })); }