@dxos/react-ui-editor 0.4.4-main.3a00f69 → 0.4.4-main.62445ee

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.
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import get from 'lodash.get';
6
- import { type Dispatch, type SetStateAction, useEffect, useState } from 'react';
6
+ import { type Dispatch, type SetStateAction, useState, useMemo } from 'react';
7
7
 
8
8
  import { generateName } from '@dxos/display-name';
9
9
  import { type AutomergeTextCompat, getRawDoc } from '@dxos/echo-schema';
@@ -27,14 +27,8 @@ export type UseTextModelProps = {
27
27
  * @deprecated
28
28
  */
29
29
  // TODO(burdon): Remove once automerge lands.
30
- export const useTextModel = (props: UseTextModelProps): EditorModel | undefined => {
31
- const [model, setModel] = useState<EditorModel>();
32
- const { identity, space, text } = props;
33
- useEffect(() => {
34
- setModel(createModel(props));
35
- }, [identity, space, text]);
36
- return model;
37
- };
30
+ export const useTextModel = (props: UseTextModelProps): EditorModel | undefined =>
31
+ useMemo(() => createModel(props), Object.values(props));
38
32
 
39
33
  /**
40
34
  * For use primarily in stories & tests so the dependence on TextObject can be avoided.