slate-react 0.66.7 → 0.67.0-202191204438

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # slate-react
2
2
 
3
+ ## 0.67.0-202191204438
4
+
5
+ ### Minor Changes
6
+
7
+ - [#4540](https://github.com/ianstormtaylor/slate/pull/4540) [`11ef83b4`](https://github.com/ianstormtaylor/slate/commit/11ef83b47fca84d1f908b5c9eeefada516fe9fed) Thanks [@bryanph](https://github.com/bryanph)! - The Slate Provider's "value" prop is now only used as initial state for editor.children as was intended before. If your code relies on replacing editor.children you should do so by replacing it directly instead of relying on the "value" prop to do this for you.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies []:
12
+ - slate@0.66.5-202191204438
13
+
3
14
  ## 0.66.7
4
15
 
5
16
  ### Patch Changes
package/dist/index.es.js CHANGED
@@ -3684,8 +3684,7 @@ var Slate = props => {
3684
3684
  } = props,
3685
3685
  rest = _objectWithoutProperties(props, _excluded);
3686
3686
 
3687
- var [key, setKey] = useState(0);
3688
- var context = useMemo(() => {
3687
+ var [context, setContext] = React.useState(() => {
3689
3688
  if (!Node.isNodeList(value)) {
3690
3689
  throw new Error("[Slate] value is invalid! Expected a list of elements" + "but got: ".concat(JSON.stringify(value)));
3691
3690
  }
@@ -3697,11 +3696,11 @@ var Slate = props => {
3697
3696
  editor.children = value;
3698
3697
  Object.assign(editor, rest);
3699
3698
  return [editor];
3700
- }, [key, value, ...Object.values(rest)]);
3699
+ });
3701
3700
  var onContextChange = useCallback(() => {
3702
3701
  onChange(editor.children);
3703
- setKey(key + 1);
3704
- }, [key, onChange]);
3702
+ setContext([editor]);
3703
+ }, [onChange]);
3705
3704
  EDITOR_TO_ON_CHANGE.set(editor, onContextChange);
3706
3705
  useEffect(() => {
3707
3706
  return () => {