@likec4/diagram 1.39.1 → 1.39.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.
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { cx } from '@likec4/styles/css';
3
3
  import { Box, ActionIcon } from '@mantine/core';
4
- import { shallowEqual } from '@mantine/hooks';
4
+ import { useCallbackRef, shallowEqual } from '@mantine/hooks';
5
5
  import { memo, useState } from 'react';
6
6
  import { isBoolean } from 'remeda';
7
7
  import { FramerMotionConfig } from '../context/FramerMotionConfig.js';
@@ -70,6 +70,9 @@ const LikeC4ViewInner = memo(({
70
70
  const colorScheme = useColorScheme(explicitColorScheme);
71
71
  const [shadowRootProps, cssstyle] = useShadowRootStyle(keepAspectRatio, view);
72
72
  const [browserViewId, onNavigateTo] = useState(null);
73
+ const onNavigateToThisView = useCallbackRef(() => {
74
+ onNavigateTo(view.id);
75
+ });
73
76
  const browserView = browserViewId ? likec4model.findView(browserViewId)?.$view : null;
74
77
  const notations = view.notation?.nodes ?? [];
75
78
  const hasNotations = notations.length > 0;
@@ -136,8 +139,8 @@ const LikeC4ViewInner = memo(({
136
139
  enableSearch: false,
137
140
  ...isBrowserEnabled && {
138
141
  onNavigateTo,
139
- onCanvasClick: () => onNavigateTo(view.id),
140
- onNodeClick: () => onNavigateTo(view.id)
142
+ onCanvasClick: onNavigateToThisView,
143
+ onNodeClick: onNavigateToThisView
141
144
  },
142
145
  reactFlowProps,
143
146
  renderNodes,