slate-react 0.128.0 → 0.128.2-20261007172010

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4503,8 +4503,8 @@ var Slate = function Slate(props) {
4503
4503
  onValueChange = props.onValueChange,
4504
4504
  initialValue = props.initialValue,
4505
4505
  rest = _objectWithoutProperties(props, _excluded);
4506
- // Run once on first mount, but before `useEffect` or render
4507
- React.useState(function () {
4506
+ var initializedEditor = React.useRef(null);
4507
+ if (initializedEditor.current !== editor) {
4508
4508
  if (!slate.Node.isNodeList(initialValue)) {
4509
4509
  throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(slate.Scrubber.stringify(initialValue)));
4510
4510
  }
@@ -4513,7 +4513,8 @@ var Slate = function Slate(props) {
4513
4513
  }
4514
4514
  editor.children = initialValue;
4515
4515
  Object.assign(editor, rest);
4516
- });
4516
+ initializedEditor.current = editor;
4517
+ }
4517
4518
  var _useSelectorContext = useSelectorContext(),
4518
4519
  selectorContext = _useSelectorContext.selectorContext,
4519
4520
  handleSelectorChange = _useSelectorContext.onChange;