@inspirer-dev/crm-dashboard 1.0.67 → 1.0.68

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.
@@ -6,6 +6,7 @@ import ReactFlow, {
6
6
  useEdgesState,
7
7
  useReactFlow,
8
8
  useStoreApi,
9
+ useUpdateNodeInternals,
9
10
  addEdge,
10
11
  type Connection,
11
12
  type OnNodesChange,
@@ -69,6 +70,7 @@ const FlowCanvas: React.FC<FlowCanvasProps> = ({
69
70
  const history = useFlowHistory();
70
71
  const { fitView, getViewport, setViewport, setCenter } = useReactFlow();
71
72
  const store = useStoreApi();
73
+ const updateNodeInternals = useUpdateNodeInternals();
72
74
 
73
75
  const validation = useMemo(() => {
74
76
  return validateFlow(nodes as FlowNode[], edges as FlowEdge[]);
@@ -298,14 +300,19 @@ const FlowCanvas: React.FC<FlowCanvasProps> = ({
298
300
  const hasPositions = steps.length > 0 && steps[0].positionX != null;
299
301
  const finalNodes = hasPositions ? n : applyAutoLayout(n, e);
300
302
  setNodes(finalNodes);
301
- setEdges(e);
302
303
 
303
- setTimeout(() => {
304
- fitViewWithOffset();
305
- }, 50);
304
+ requestAnimationFrame(() => {
305
+ finalNodes.forEach((node) => updateNodeInternals(node.id));
306
+ requestAnimationFrame(() => {
307
+ setEdges(e);
308
+ setTimeout(() => {
309
+ fitViewWithOffset();
310
+ }, 50);
311
+ });
312
+ });
306
313
  }
307
314
  isInitialMount.current = false;
308
- }, [steps, setNodes, setEdges, fitViewWithOffset]);
315
+ }, [steps, setNodes, setEdges, fitViewWithOffset, updateNodeInternals]);
309
316
 
310
317
  const syncToParent = useCallback(() => {
311
318
  if (isInitialMount.current) return;
@@ -3473,6 +3473,7 @@ const FlowCanvas = ({
3473
3473
  const history = useFlowHistory();
3474
3474
  const { fitView, getViewport, setViewport, setCenter } = ReactFlow.useReactFlow();
3475
3475
  const store = ReactFlow.useStoreApi();
3476
+ const updateNodeInternals = ReactFlow.useUpdateNodeInternals();
3476
3477
  const validation = React.useMemo(() => {
3477
3478
  return validateFlow(nodes, edges);
3478
3479
  }, [nodes, edges]);
@@ -3642,13 +3643,18 @@ const FlowCanvas = ({
3642
3643
  const hasPositions = steps.length > 0 && steps[0].positionX != null;
3643
3644
  const finalNodes = hasPositions ? n : applyAutoLayout(n, e);
3644
3645
  setNodes(finalNodes);
3645
- setEdges(e);
3646
- setTimeout(() => {
3647
- fitViewWithOffset();
3648
- }, 50);
3646
+ requestAnimationFrame(() => {
3647
+ finalNodes.forEach((node) => updateNodeInternals(node.id));
3648
+ requestAnimationFrame(() => {
3649
+ setEdges(e);
3650
+ setTimeout(() => {
3651
+ fitViewWithOffset();
3652
+ }, 50);
3653
+ });
3654
+ });
3649
3655
  }
3650
3656
  isInitialMount.current = false;
3651
- }, [steps, setNodes, setEdges, fitViewWithOffset]);
3657
+ }, [steps, setNodes, setEdges, fitViewWithOffset, updateNodeInternals]);
3652
3658
  const syncToParent = React.useCallback(() => {
3653
3659
  if (isInitialMount.current) return;
3654
3660
  if (syncTimeoutRef.current) {
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { createContext, useContext, memo, useState, useEffect, useCallback, useRef, useMemo, forwardRef } from "react";
3
- import ReactFlow, { Handle, Position, useReactFlow, getSimpleBezierPath, BaseEdge, EdgeLabelRenderer, useNodesState, useEdgesState, useStoreApi, addEdge, Background, MiniMap, ReactFlowProvider } from "reactflow";
3
+ import ReactFlow, { Handle, Position, useReactFlow, getSimpleBezierPath, BaseEdge, EdgeLabelRenderer, useNodesState, useEdgesState, useStoreApi, useUpdateNodeInternals, addEdge, Background, MiniMap, ReactFlowProvider } from "reactflow";
4
4
  import "reactflow/dist/style.css";
5
5
  import { Flex, Box, Typography, SingleSelect, SingleSelectOption, TextInput, NumberInput, Loader, Tooltip, Field, Badge as Badge$1, Modal } from "@strapi/design-system";
6
6
  import { Plus, Trash, Cross, Layout, Pencil } from "@strapi/icons";
@@ -3468,6 +3468,7 @@ const FlowCanvas = ({
3468
3468
  const history = useFlowHistory();
3469
3469
  const { fitView, getViewport, setViewport, setCenter } = useReactFlow();
3470
3470
  const store = useStoreApi();
3471
+ const updateNodeInternals = useUpdateNodeInternals();
3471
3472
  const validation = useMemo(() => {
3472
3473
  return validateFlow(nodes, edges);
3473
3474
  }, [nodes, edges]);
@@ -3637,13 +3638,18 @@ const FlowCanvas = ({
3637
3638
  const hasPositions = steps.length > 0 && steps[0].positionX != null;
3638
3639
  const finalNodes = hasPositions ? n : applyAutoLayout(n, e);
3639
3640
  setNodes(finalNodes);
3640
- setEdges(e);
3641
- setTimeout(() => {
3642
- fitViewWithOffset();
3643
- }, 50);
3641
+ requestAnimationFrame(() => {
3642
+ finalNodes.forEach((node) => updateNodeInternals(node.id));
3643
+ requestAnimationFrame(() => {
3644
+ setEdges(e);
3645
+ setTimeout(() => {
3646
+ fitViewWithOffset();
3647
+ }, 50);
3648
+ });
3649
+ });
3644
3650
  }
3645
3651
  isInitialMount.current = false;
3646
- }, [steps, setNodes, setEdges, fitViewWithOffset]);
3652
+ }, [steps, setNodes, setEdges, fitViewWithOffset, updateNodeInternals]);
3647
3653
  const syncToParent = useCallback(() => {
3648
3654
  if (isInitialMount.current) return;
3649
3655
  if (syncTimeoutRef.current) {
@@ -131,7 +131,7 @@ const index = {
131
131
  components: {
132
132
  Input: async () => Promise.resolve().then(() => require(
133
133
  /* webpackChunkName: "crm-step-flow-builder" */
134
- "../_chunks/index-BOwaSLls.js"
134
+ "../_chunks/index-CzxnKN-q.js"
135
135
  ))
136
136
  },
137
137
  options: {
@@ -130,7 +130,7 @@ const index = {
130
130
  components: {
131
131
  Input: async () => import(
132
132
  /* webpackChunkName: "crm-step-flow-builder" */
133
- "../_chunks/index-sbrdEB7Z.mjs"
133
+ "../_chunks/index-D6i3MTUb.mjs"
134
134
  )
135
135
  },
136
136
  options: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inspirer-dev/crm-dashboard",
3
- "version": "1.0.67",
3
+ "version": "1.0.68",
4
4
  "description": "CRM Dashboard and Tools",
5
5
  "strapi": {
6
6
  "name": "crm-dashboard",