@mdxeditor/editor 0.15.1 → 0.15.2

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.
Files changed (2) hide show
  1. package/dist/gurx/react.js +11 -4
  2. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import React__default from "react";
1
+ import React__default, { useEffect } from "react";
2
2
  import { tap, always } from "../utils/fp.js";
3
3
  import { realmFactory } from "./realmFactory.js";
4
4
  function omit(keys, obj) {
@@ -98,14 +98,21 @@ function sysHooks() {
98
98
  const useEmitterValues = (...keys) => {
99
99
  const realm = React__default.useContext(Context);
100
100
  const [values, setValues] = React__default.useState(() => realm.getKeyValues(keys));
101
- useIsomorphicLayoutEffect(
101
+ useEffect(
102
102
  () => realm == null ? void 0 : realm.subKeys(keys, (newValues) => {
103
103
  const setter = () => {
104
- setValues(keys.length === 1 ? [newValues] : newValues);
104
+ if (keys.length === 1) {
105
+ newValues = [newValues];
106
+ }
107
+ for (let i = 0; i < keys.length; i++) {
108
+ if (newValues[i] !== values[i]) {
109
+ setValues(newValues);
110
+ }
111
+ }
105
112
  };
106
113
  setter();
107
114
  }),
108
- [keys]
115
+ [keys, realm, values]
109
116
  );
110
117
  return values;
111
118
  };
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "private": false,
10
10
  "sideEffects": false,
11
11
  "type": "module",
12
- "version": "0.15.1",
12
+ "version": "0.15.2",
13
13
  "description": "React component for rich text markdown editing",
14
14
  "scripts": {
15
15
  "build": "vite build",