Showing
3 changed files
with
76 additions
and
69 deletions
... | ... | @@ -171,37 +171,40 @@ var ExtendedWidget = function ExtendedWidget(_ref) { |
171 | 171 | }, /*#__PURE__*/React.createElement("div", { |
172 | 172 | className: "fr-item-wrapper" |
173 | 173 | }, /*#__PURE__*/React.createElement(Widget, finalProps))); |
174 | -}; // const areEqual = (prev, current) => { | |
175 | -// if (prev.schema && current.schema) { | |
176 | -// if (prev.schema.$id === '#') { | |
177 | -// return false; | |
178 | -// } | |
179 | -// if (prev.schema.hidden && current.schema.hidden) { | |
180 | -// return true; | |
181 | -// } | |
182 | -// } | |
183 | -// if (prev.readOnly !== current.readOnly) { | |
184 | -// return false; | |
185 | -// } | |
186 | -// if (prev.disabled !== current.disabled) { | |
187 | -// return false; | |
188 | -// } | |
189 | -// if ( | |
190 | -// JSON.stringify(prev.dependValues) !== JSON.stringify(current.dependValues) | |
191 | -// ) { | |
192 | -// return false; | |
193 | -// } | |
194 | -// if (isObjType(prev.schema) && isObjType(current.schema)) { | |
195 | -// return false; | |
196 | -// } | |
197 | -// if ( | |
198 | -// JSON.stringify(prev.value) === JSON.stringify(current.value) && | |
199 | -// JSON.stringify(prev.schema) === JSON.stringify(current.schema) | |
200 | -// ) { | |
201 | -// return true; | |
202 | -// } | |
203 | -// return false; | |
204 | -// }; | |
205 | - | |
206 | - | |
207 | -export default ExtendedWidget; | |
\ No newline at end of file | ||
174 | +}; | |
175 | + | |
176 | +var areEqual = function areEqual(prev, current) { | |
177 | + if (prev.schema && current.schema) { | |
178 | + if (prev.schema.$id === '#') { | |
179 | + return false; | |
180 | + } | |
181 | + | |
182 | + if (prev.schema.hidden && current.schema.hidden) { | |
183 | + return true; | |
184 | + } | |
185 | + } | |
186 | + | |
187 | + if (prev.readOnly !== current.readOnly) { | |
188 | + return false; | |
189 | + } | |
190 | + | |
191 | + if (prev.disabled !== current.disabled) { | |
192 | + return false; | |
193 | + } | |
194 | + | |
195 | + if (JSON.stringify(prev.dependValues) !== JSON.stringify(current.dependValues)) { | |
196 | + return false; | |
197 | + } | |
198 | + | |
199 | + if (isObjType(prev.schema) && isObjType(current.schema)) { | |
200 | + return false; | |
201 | + } | |
202 | + | |
203 | + if (JSON.stringify(prev.value) === JSON.stringify(current.value) && JSON.stringify(prev.schema) === JSON.stringify(current.schema)) { | |
204 | + return true; | |
205 | + } | |
206 | + | |
207 | + return false; | |
208 | +}; | |
209 | + | |
210 | +export default /*#__PURE__*/React.memo(ExtendedWidget, areEqual); | |
\ No newline at end of file | ... | ... |
... | ... | @@ -188,38 +188,42 @@ var ExtendedWidget = function ExtendedWidget(_ref) { |
188 | 188 | }, /*#__PURE__*/_react.default.createElement("div", { |
189 | 189 | className: "fr-item-wrapper" |
190 | 190 | }, /*#__PURE__*/_react.default.createElement(Widget, finalProps))); |
191 | -}; // const areEqual = (prev, current) => { | |
192 | -// if (prev.schema && current.schema) { | |
193 | -// if (prev.schema.$id === '#') { | |
194 | -// return false; | |
195 | -// } | |
196 | -// if (prev.schema.hidden && current.schema.hidden) { | |
197 | -// return true; | |
198 | -// } | |
199 | -// } | |
200 | -// if (prev.readOnly !== current.readOnly) { | |
201 | -// return false; | |
202 | -// } | |
203 | -// if (prev.disabled !== current.disabled) { | |
204 | -// return false; | |
205 | -// } | |
206 | -// if ( | |
207 | -// JSON.stringify(prev.dependValues) !== JSON.stringify(current.dependValues) | |
208 | -// ) { | |
209 | -// return false; | |
210 | -// } | |
211 | -// if (isObjType(prev.schema) && isObjType(current.schema)) { | |
212 | -// return false; | |
213 | -// } | |
214 | -// if ( | |
215 | -// JSON.stringify(prev.value) === JSON.stringify(current.value) && | |
216 | -// JSON.stringify(prev.schema) === JSON.stringify(current.schema) | |
217 | -// ) { | |
218 | -// return true; | |
219 | -// } | |
220 | -// return false; | |
221 | -// }; | |
222 | - | |
223 | - | |
224 | -var _default = ExtendedWidget; | |
191 | +}; | |
192 | + | |
193 | +var areEqual = function areEqual(prev, current) { | |
194 | + if (prev.schema && current.schema) { | |
195 | + if (prev.schema.$id === '#') { | |
196 | + return false; | |
197 | + } | |
198 | + | |
199 | + if (prev.schema.hidden && current.schema.hidden) { | |
200 | + return true; | |
201 | + } | |
202 | + } | |
203 | + | |
204 | + if (prev.readOnly !== current.readOnly) { | |
205 | + return false; | |
206 | + } | |
207 | + | |
208 | + if (prev.disabled !== current.disabled) { | |
209 | + return false; | |
210 | + } | |
211 | + | |
212 | + if (JSON.stringify(prev.dependValues) !== JSON.stringify(current.dependValues)) { | |
213 | + return false; | |
214 | + } | |
215 | + | |
216 | + if ((0, _utils.isObjType)(prev.schema) && (0, _utils.isObjType)(current.schema)) { | |
217 | + return false; | |
218 | + } | |
219 | + | |
220 | + if (JSON.stringify(prev.value) === JSON.stringify(current.value) && JSON.stringify(prev.schema) === JSON.stringify(current.schema)) { | |
221 | + return true; | |
222 | + } | |
223 | + | |
224 | + return false; | |
225 | +}; | |
226 | + | |
227 | +var _default = /*#__PURE__*/_react.default.memo(ExtendedWidget, areEqual); | |
228 | + | |
225 | 229 | exports.default = _default; |
\ No newline at end of file | ... | ... |