UNPKG

@lyra/form-builder

Version:
22 lines (18 loc) 695 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = UpdateCustomNodesPlugin; // This plugin makes sure the custom nodes updates when needed due to external factors. // Slate heavily restricts the shouldComponentUpdate by default. Thus markers // and similar that change on the outside may not properly update the custom node components function UpdateCustomNodesPlugin() { return { shouldNodeComponentUpdate(previousProps, nextProps) { if (!previousProps.markers || previousProps.markers && nextProps.markers && previousProps.markers.length !== nextProps.markers.length) { return true; } return false; } }; }