@mgamadeus/ddd-design-studio 0.2.0 → 0.2.1

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.
@@ -2243,7 +2243,9 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2243
2243
  const [presentSectionId, setPresentSectionId] = useState8(null);
2244
2244
  const [fitRequest, setFitRequest] = useState8(null);
2245
2245
  const [tool, setTool] = useState8("hand");
2246
- const [isCommentsPanelOpen, setIsCommentsPanelOpen] = useState8(() => storage.read("commentsPanelOpen") !== "0");
2246
+ const [isCommentsPanelOpen, setIsCommentsPanelOpen] = useState8(
2247
+ () => Boolean(searchParams.get(CODE_PARAM)) || storage.read("commentsPanelOpen") !== "0"
2248
+ );
2247
2249
  const canvasState = router.useUrlState(CANVAS_STATE_KEYS, {
2248
2250
  stateId: `designCanvas.${projectKey}.${canvasKey}`,
2249
2251
  debounceMs: 250,
@@ -2592,9 +2594,21 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2592
2594
  const nodeId = boardNodeId(board.boardKey);
2593
2595
  setSelectedBoardId(nodeId);
2594
2596
  setSelectedBoardIds(/* @__PURE__ */ new Set([nodeId]));
2595
- setIsCommentsPanelOpen(true);
2596
- if (!isFirstView) requestFit([nodeId]);
2597
- }, [codeParam, codeAtLoad, boards, writeSearchParams, notify, texts, requestFit]);
2597
+ if (isFirstView) return;
2598
+ if (isCommentsPanelOpen) {
2599
+ requestFit([nodeId]);
2600
+ } else {
2601
+ pendingCodeFitRef.current = nodeId;
2602
+ setIsCommentsPanelOpen(true);
2603
+ }
2604
+ }, [codeParam, codeAtLoad, boards, isCommentsPanelOpen, writeSearchParams, notify, texts, requestFit]);
2605
+ const pendingCodeFitRef = useRef3(null);
2606
+ useEffect6(() => {
2607
+ const nodeId = pendingCodeFitRef.current;
2608
+ if (!nodeId || layout.sections.length === 0) return;
2609
+ pendingCodeFitRef.current = null;
2610
+ requestFit([nodeId]);
2611
+ }, [layout, requestFit]);
2598
2612
  const stepFocus = useCallback2(
2599
2613
  (step) => {
2600
2614
  if (!focusedBoardId || navigationOrder.length === 0) return;