@snowcone-app/ui 0.11.4 → 0.11.6

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
@@ -5802,12 +5802,15 @@ function RealtimeProvider({
5802
5802
  const [unavailableMockups, setUnavailableMockups] = useState17(
5803
5803
  () => /* @__PURE__ */ new Map()
5804
5804
  );
5805
+ const resetSessionRef = useRef12(() => {
5806
+ });
5805
5807
  const realtimeMockup = useRealtimeMockup2({
5806
5808
  wsUrl,
5807
5809
  getToken: useSessionGrant ? getToken : void 0,
5808
5810
  onConnected: (sessionId) => {
5809
5811
  },
5810
5812
  onDisconnected: () => {
5813
+ resetSessionRef.current();
5811
5814
  },
5812
5815
  onConfigReceived: () => {
5813
5816
  },
@@ -6488,23 +6491,27 @@ function RealtimeProvider({
6488
6491
  },
6489
6492
  [sendColorBlob]
6490
6493
  );
6494
+ const resetSession = useCallback10(() => {
6495
+ configSentRef.current = false;
6496
+ dueByVersionRef.current.clear();
6497
+ setUnavailableMockups((prev) => prev.size ? /* @__PURE__ */ new Map() : prev);
6498
+ lastSentVariantIdRef.current = null;
6499
+ lastSentBgRef.current = void 0;
6500
+ lastSentSpreadCropsRef.current = "null";
6501
+ lastSentColorsRef.current = {};
6502
+ invalidateBackgrounds();
6503
+ lastConfigBaseRef.current = null;
6504
+ }, [invalidateBackgrounds]);
6505
+ resetSessionRef.current = resetSession;
6491
6506
  useEffect17(() => {
6492
6507
  if (isEnabled) {
6493
6508
  connect();
6494
6509
  return () => {
6495
6510
  disconnect();
6496
- configSentRef.current = false;
6497
- dueByVersionRef.current.clear();
6498
- setUnavailableMockups((prev) => prev.size ? /* @__PURE__ */ new Map() : prev);
6499
- lastSentVariantIdRef.current = null;
6500
- lastSentBgRef.current = void 0;
6501
- lastSentSpreadCropsRef.current = "null";
6502
- lastSentColorsRef.current = {};
6503
- invalidateBackgrounds();
6504
- lastConfigBaseRef.current = null;
6511
+ resetSession();
6505
6512
  };
6506
6513
  }
6507
- }, [isEnabled, connect, disconnect, wsUrl, invalidateBackgrounds]);
6514
+ }, [isEnabled, connect, disconnect, wsUrl, resetSession]);
6508
6515
  useEffect17(() => {
6509
6516
  if (rawMockupResults.length > 0 && isPendingMockupsRef.current) {
6510
6517
  isPendingMockupsRef.current = false;