@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/CHANGELOG.md +16 -0
- package/dist/index.cjs +17 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -10
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/composed/__tests__/HeroProductImage.ssr-match.test.tsx +34 -15
- package/src/patterns/RealtimeProvider.tsx +21 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.11.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#6076](https://github.com/snowcone-app/snowcone-monorepo/pull/6076) [`4c08318`](https://github.com/snowcone-app/snowcone-monorepo/commit/4c08318f53dd0a477d6e25482095211b98048dfc) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Realtime: a socket that closes on its own now reconnects (0.5 s backoff, capped at 10 s) and re-renders the latest design on the new session. Before, nothing reopened it and live mockups froze while the editor kept changing.
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`4c08318`](https://github.com/snowcone-app/snowcone-monorepo/commit/4c08318f53dd0a477d6e25482095211b98048dfc)]:
|
|
10
|
+
- @snowcone-app/sdk@0.31.12
|
|
11
|
+
|
|
12
|
+
## 0.11.5
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [[`7411c1f`](https://github.com/snowcone-app/snowcone-monorepo/commit/7411c1f96b0f59b286851b0ca1fb52eeed101aaa)]:
|
|
17
|
+
- @snowcone-app/sdk@0.31.11
|
|
18
|
+
|
|
3
19
|
## 0.11.4
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -6173,12 +6173,15 @@ function RealtimeProvider({
|
|
|
6173
6173
|
const [unavailableMockups, setUnavailableMockups] = (0, import_react25.useState)(
|
|
6174
6174
|
() => /* @__PURE__ */ new Map()
|
|
6175
6175
|
);
|
|
6176
|
+
const resetSessionRef = (0, import_react25.useRef)(() => {
|
|
6177
|
+
});
|
|
6176
6178
|
const realtimeMockup = (0, import_react26.useRealtimeMockup)({
|
|
6177
6179
|
wsUrl,
|
|
6178
6180
|
getToken: useSessionGrant ? getToken : void 0,
|
|
6179
6181
|
onConnected: (sessionId) => {
|
|
6180
6182
|
},
|
|
6181
6183
|
onDisconnected: () => {
|
|
6184
|
+
resetSessionRef.current();
|
|
6182
6185
|
},
|
|
6183
6186
|
onConfigReceived: () => {
|
|
6184
6187
|
},
|
|
@@ -6859,23 +6862,27 @@ function RealtimeProvider({
|
|
|
6859
6862
|
},
|
|
6860
6863
|
[sendColorBlob]
|
|
6861
6864
|
);
|
|
6865
|
+
const resetSession = (0, import_react25.useCallback)(() => {
|
|
6866
|
+
configSentRef.current = false;
|
|
6867
|
+
dueByVersionRef.current.clear();
|
|
6868
|
+
setUnavailableMockups((prev) => prev.size ? /* @__PURE__ */ new Map() : prev);
|
|
6869
|
+
lastSentVariantIdRef.current = null;
|
|
6870
|
+
lastSentBgRef.current = void 0;
|
|
6871
|
+
lastSentSpreadCropsRef.current = "null";
|
|
6872
|
+
lastSentColorsRef.current = {};
|
|
6873
|
+
invalidateBackgrounds();
|
|
6874
|
+
lastConfigBaseRef.current = null;
|
|
6875
|
+
}, [invalidateBackgrounds]);
|
|
6876
|
+
resetSessionRef.current = resetSession;
|
|
6862
6877
|
(0, import_react25.useEffect)(() => {
|
|
6863
6878
|
if (isEnabled) {
|
|
6864
6879
|
connect();
|
|
6865
6880
|
return () => {
|
|
6866
6881
|
disconnect();
|
|
6867
|
-
|
|
6868
|
-
dueByVersionRef.current.clear();
|
|
6869
|
-
setUnavailableMockups((prev) => prev.size ? /* @__PURE__ */ new Map() : prev);
|
|
6870
|
-
lastSentVariantIdRef.current = null;
|
|
6871
|
-
lastSentBgRef.current = void 0;
|
|
6872
|
-
lastSentSpreadCropsRef.current = "null";
|
|
6873
|
-
lastSentColorsRef.current = {};
|
|
6874
|
-
invalidateBackgrounds();
|
|
6875
|
-
lastConfigBaseRef.current = null;
|
|
6882
|
+
resetSession();
|
|
6876
6883
|
};
|
|
6877
6884
|
}
|
|
6878
|
-
}, [isEnabled, connect, disconnect, wsUrl,
|
|
6885
|
+
}, [isEnabled, connect, disconnect, wsUrl, resetSession]);
|
|
6879
6886
|
(0, import_react25.useEffect)(() => {
|
|
6880
6887
|
if (rawMockupResults.length > 0 && isPendingMockupsRef.current) {
|
|
6881
6888
|
isPendingMockupsRef.current = false;
|