@plotwork.official/viewer 0.1.3 → 0.1.4

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.
@@ -10,14 +10,9 @@ function PlotworkDiagramInner(props, ref) {
10
10
  useClientLayoutEffect(() => {
11
11
  definePlotworkDiagram();
12
12
  }, []);
13
+ // Listens before the picture is handed over below: a picture the page already holds loads within a few microtasks, which
14
+ // can be before a passive effect runs, and its `plotwork-load` would be missed.
13
15
  useClientLayoutEffect(() => {
14
- const node = element.current;
15
- if (node === null)
16
- return;
17
- node.labels = props.labels;
18
- node.svg = props.svg ?? null;
19
- }, [props.svg, props.labels]);
20
- useEffect(() => {
21
16
  const node = element.current;
22
17
  if (node === null)
23
18
  return undefined;
@@ -34,6 +29,13 @@ function PlotworkDiagramInner(props, ref) {
34
29
  remove();
35
30
  };
36
31
  }, []);
32
+ useClientLayoutEffect(() => {
33
+ const node = element.current;
34
+ if (node === null)
35
+ return;
36
+ node.labels = props.labels;
37
+ node.svg = props.svg ?? null;
38
+ }, [props.svg, props.labels]);
37
39
  return createElement(TAG_NAME, {
38
40
  ref: element,
39
41
  src: props.src,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plotwork.official/viewer",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Embed interactive Plotwork diagrams in any page: a <plotwork-diagram> web component and a React component, with no runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "type": "module",