@fileverse-dev/dsheet 2.0.36-rtc-8 → 2.0.36-rtc-9

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.
@@ -45642,6 +45642,11 @@ class lS {
45642
45642
  sessionDid: (t = this.collaborationKeyPair) == null ? void 0 : t.did()
45643
45643
  };
45644
45644
  await this._emitWithAck("/documents/terminate", o);
45645
+ } catch (n) {
45646
+ console.warn(
45647
+ "[SocketClient] /documents/terminate failed — disconnected locally",
45648
+ n
45649
+ );
45645
45650
  } finally {
45646
45651
  this.disconnect();
45647
45652
  }
@@ -46091,6 +46096,8 @@ class uS {
46091
46096
  Te(this, "uncommittedUpdatesIdList", []);
46092
46097
  Te(this, "contentTobeAppliedQueue", []);
46093
46098
  Te(this, "isProcessing", !1);
46099
+ /** Prevents parallel terminateSession calls (UI + effect cleanup). */
46100
+ Te(this, "_terminating", !1);
46094
46101
  Te(this, "flushTimer", null);
46095
46102
  Te(this, "FLUSH_INTERVAL_MS", 50);
46096
46103
  Te(this, "MAX_QUEUE_SIZE", 5);
@@ -46178,16 +46185,24 @@ class uS {
46178
46185
  }
46179
46186
  async terminateSession() {
46180
46187
  var t, n;
46181
- if (this._status !== "idle") {
46182
- await this.awaitFlush();
46188
+ if (!(this._status === "idle" || this._terminating)) {
46189
+ this._terminating = !0;
46183
46190
  try {
46184
- this._awareness && $o(
46185
- this._awareness,
46186
- [this.ydoc.clientID],
46187
- "session terminated"
46188
- ), this.isOwner ? await ((t = this.socketClient) == null ? void 0 : t.terminateSession()) : (n = this.socketClient) == null || n.disconnect();
46191
+ await this.awaitFlush();
46192
+ try {
46193
+ this._awareness && $o(
46194
+ this._awareness,
46195
+ [this.ydoc.clientID],
46196
+ "session terminated"
46197
+ ), this.isOwner ? await ((t = this.socketClient) == null ? void 0 : t.terminateSession()) : (n = this.socketClient) == null || n.disconnect();
46198
+ } catch (o) {
46199
+ console.warn(
46200
+ "[SyncManager] terminateSession socket step failed (local cleanup continues)",
46201
+ o
46202
+ );
46203
+ }
46189
46204
  } finally {
46190
- this.resetInternalState(), this.send({
46205
+ this._terminating = !1, this.resetInternalState(), this.send({
46191
46206
  type: "SESSION_TERMINATED",
46192
46207
  reason: "User terminated session"
46193
46208
  }), this.send({ type: "RESET" });
@@ -46710,7 +46725,12 @@ const fS = { status: "idle" }, dS = (e) => {
46710
46725
  ), l = Ee(() => {
46711
46726
  r.disconnect();
46712
46727
  }, [r]), f = Ee(() => {
46713
- r.terminateSession();
46728
+ r.terminateSession().catch((p) => {
46729
+ console.warn(
46730
+ "useSyncManager: terminateSession failed (session reset locally)",
46731
+ p
46732
+ );
46733
+ });
46714
46734
  }, [r]), c = t.status === "syncing", d = t.status === "ready" && !!a, h = t.status === "ready" || t.status === "reconnecting";
46715
46735
  return {
46716
46736
  state: t,
@@ -50600,7 +50620,7 @@ const Er = ({
50600
50620
  }, w.readAsText(h);
50601
50621
  });
50602
50622
  }, G0 = async (e, t, n, o) => {
50603
- const { handleExportToXLSX: r } = await import("./xlsx-export-impl-CRw27cg1.js");
50623
+ const { handleExportToXLSX: r } = await import("./xlsx-export-impl-Dg1hG0qJ.js");
50604
50624
  return r(e, t, n, o);
50605
50625
  }, uN = (e) => {
50606
50626
  var n;
@@ -50675,7 +50695,7 @@ const Er = ({
50675
50695
  const [a, i] = Ie(!1);
50676
50696
  return { handleXLSXUpload: Ee(
50677
50697
  async (f, c, d) => {
50678
- const { runXlsxFileUpload: h } = await import("./use-xlsx-import-impl-Cu-q8lC5.js");
50698
+ const { runXlsxFileUpload: h } = await import("./use-xlsx-import-impl-CxD2NAQy.js");
50679
50699
  return h(
50680
50700
  {
50681
50701
  sheetEditorRef: e,
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { S as s, a as l, i as o, T as t, b as r, d as n, e as d, h as S, f as h, g as i, j as c, k as m, l as C, n as p, o as E, p as x, q as F, r as g, s as R, t as f, u as L, v as b, w as u, x as T, z as A } from "./index-CpskXdSI.js";
1
+ import { S as s, a as l, i as o, T as t, b as r, d as n, e as d, h as S, f as h, g as i, j as c, k as m, l as C, n as p, o as E, p as x, q as F, r as g, s as R, t as f, u as L, v as b, w as u, x as T, z as A } from "./index-BTXKOfeE.js";
2
2
  import { bL as w, bM as k, bN as V, bR as z, bb as M, e as X, f as _, h as j, a as v, cc as y, aq as P, cj as U } from "./executeStringFunction-F9mb-SpN.js";
3
3
  import { FLVURL as D } from "@fileverse-dev/formulajs";
4
4
  import { E as H, S as N } from "./constants-yStXQJiK.js";
@@ -14,6 +14,8 @@ export declare class SyncManager {
14
14
  private uncommittedUpdatesIdList;
15
15
  private contentTobeAppliedQueue;
16
16
  private isProcessing;
17
+ /** Prevents parallel terminateSession calls (UI + effect cleanup). */
18
+ private _terminating;
17
19
  private flushTimer;
18
20
  private readonly FLUSH_INTERVAL_MS;
19
21
  private readonly MAX_QUEUE_SIZE;
@@ -1,6 +1,6 @@
1
1
  import { g as Ue } from "./executeStringFunction-F9mb-SpN.js";
2
2
  import * as qe from "yjs";
3
- import { m as Xe, y as Ze } from "./index-CpskXdSI.js";
3
+ import { m as Xe, y as Ze } from "./index-BTXKOfeE.js";
4
4
  import { n as Je } from "./xlsx-hyperlink-inline-DzewAypN.js";
5
5
  import { toast as Be } from "@fileverse/ui";
6
6
  var We = { exports: {} };
@@ -3,7 +3,7 @@ import { Workbook as Pt } from "exceljs";
3
3
  import { toast as Ut } from "@fileverse/ui";
4
4
  import { addFortuneImagesToWorksheet as Lt } from "./xlsx-image-utils-Cvg0qxRA.js";
5
5
  import { g as jt, c as xt } from "./executeStringFunction-F9mb-SpN.js";
6
- import { c as Ct } from "./index-CpskXdSI.js";
6
+ import { c as Ct } from "./index-BTXKOfeE.js";
7
7
  import { c as zt, g as Wt } from "./xlsx-hyperlink-inline-DzewAypN.js";
8
8
  const Mt = {
9
9
  1: "thin",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fileverse-dev/dsheet",
3
3
  "private": false,
4
4
  "description": "DSheet",
5
- "version": "2.0.36-rtc-8",
5
+ "version": "2.0.36-rtc-9",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {