rita-workspace 0.5.16 → 0.5.17

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.
package/dist/index.js CHANGED
@@ -548,9 +548,11 @@ function WorkspaceProvider({ children, lang = "en" }) {
548
548
  channel?.close();
549
549
  };
550
550
  }, []);
551
+ const hasCleanedUpRef = (0, import_react.useRef)(false);
551
552
  (0, import_react.useEffect)(() => {
552
553
  cleanupStaleTabs();
553
554
  const timer = setTimeout(() => {
555
+ hasCleanedUpRef.current = true;
554
556
  const drawingId = activeDrawingIdRef.current;
555
557
  if (drawingId) {
556
558
  setIsDrawingConflict(isDrawingOpenedEarlierInOtherTab(drawingId));
@@ -561,10 +563,12 @@ function WorkspaceProvider({ children, lang = "en" }) {
561
563
  (0, import_react.useEffect)(() => {
562
564
  const drawingId = activeDrawing?.id || null;
563
565
  setTabDrawing(drawingId);
564
- if (drawingId) {
565
- setIsDrawingConflict(isDrawingOpenedEarlierInOtherTab(drawingId));
566
- } else {
567
- setIsDrawingConflict(false);
566
+ if (hasCleanedUpRef.current) {
567
+ if (drawingId) {
568
+ setIsDrawingConflict(isDrawingOpenedEarlierInOtherTab(drawingId));
569
+ } else {
570
+ setIsDrawingConflict(false);
571
+ }
568
572
  }
569
573
  const recheckConflict = () => {
570
574
  if (drawingId) {
@@ -2084,7 +2088,7 @@ var DrawingsDialog = ({
2084
2088
  }
2085
2089
  },
2086
2090
  children: [
2087
- isRefreshing && drawings.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { padding: "24px 20px", textAlign: "center", color: "var(--text-secondary-color, #666)" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { display: "inline-block", animation: "spin 1s linear infinite", fontSize: "24px" }, children: "\u23F3" }) }) : drawings.length > 0 || folders.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { padding: "8px 20px 0" }, onClick: () => setSelectedId(null), children: [
2091
+ isRefreshing ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { padding: "24px 20px", textAlign: "center", color: "var(--text-secondary-color, #666)" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { display: "inline-block", animation: "spin 1s linear infinite", fontSize: "24px" }, children: "\u23F3" }) }) : drawings.length > 0 || folders.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { padding: "8px 20px 0" }, onClick: () => setSelectedId(null), children: [
2088
2092
  filteredFolders.map(renderFolderGroup),
2089
2093
  draggingDrawingId && folders.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2090
2094
  "div",
package/dist/index.mjs CHANGED
@@ -480,9 +480,11 @@ function WorkspaceProvider({ children, lang = "en" }) {
480
480
  channel?.close();
481
481
  };
482
482
  }, []);
483
+ const hasCleanedUpRef = useRef(false);
483
484
  useEffect(() => {
484
485
  cleanupStaleTabs();
485
486
  const timer = setTimeout(() => {
487
+ hasCleanedUpRef.current = true;
486
488
  const drawingId = activeDrawingIdRef.current;
487
489
  if (drawingId) {
488
490
  setIsDrawingConflict(isDrawingOpenedEarlierInOtherTab(drawingId));
@@ -493,10 +495,12 @@ function WorkspaceProvider({ children, lang = "en" }) {
493
495
  useEffect(() => {
494
496
  const drawingId = activeDrawing?.id || null;
495
497
  setTabDrawing(drawingId);
496
- if (drawingId) {
497
- setIsDrawingConflict(isDrawingOpenedEarlierInOtherTab(drawingId));
498
- } else {
499
- setIsDrawingConflict(false);
498
+ if (hasCleanedUpRef.current) {
499
+ if (drawingId) {
500
+ setIsDrawingConflict(isDrawingOpenedEarlierInOtherTab(drawingId));
501
+ } else {
502
+ setIsDrawingConflict(false);
503
+ }
500
504
  }
501
505
  const recheckConflict = () => {
502
506
  if (drawingId) {
@@ -2016,7 +2020,7 @@ var DrawingsDialog = ({
2016
2020
  }
2017
2021
  },
2018
2022
  children: [
2019
- isRefreshing && drawings.length === 0 ? /* @__PURE__ */ jsx6("div", { style: { padding: "24px 20px", textAlign: "center", color: "var(--text-secondary-color, #666)" }, children: /* @__PURE__ */ jsx6("span", { style: { display: "inline-block", animation: "spin 1s linear infinite", fontSize: "24px" }, children: "\u23F3" }) }) : drawings.length > 0 || folders.length > 0 ? /* @__PURE__ */ jsxs4("div", { style: { padding: "8px 20px 0" }, onClick: () => setSelectedId(null), children: [
2023
+ isRefreshing ? /* @__PURE__ */ jsx6("div", { style: { padding: "24px 20px", textAlign: "center", color: "var(--text-secondary-color, #666)" }, children: /* @__PURE__ */ jsx6("span", { style: { display: "inline-block", animation: "spin 1s linear infinite", fontSize: "24px" }, children: "\u23F3" }) }) : drawings.length > 0 || folders.length > 0 ? /* @__PURE__ */ jsxs4("div", { style: { padding: "8px 20px 0" }, onClick: () => setSelectedId(null), children: [
2020
2024
  filteredFolders.map(renderFolderGroup),
2021
2025
  draggingDrawingId && folders.length > 0 && /* @__PURE__ */ jsx6(
2022
2026
  "div",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rita-workspace",
3
- "version": "0.5.16",
3
+ "version": "0.5.17",
4
4
  "description": "Multi-drawing workspace feature for Rita (Excalidraw fork)",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",