@snowcone-app/ui 0.10.0 → 0.10.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#4445](https://github.com/snowcone-app/snowcone-monorepo/pull/4445) [`13b12bb`](https://github.com/snowcone-app/snowcone-monorepo/commit/13b12bbfec1a24e3efb4c5814a47de12f44bbb63) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Phone editor: the catch-up (every picture) starts only when the edit's own newest version has landed and no further export is on its way. On a slow link the editor-open frames were still arriving when a drag began; their settle started a 31-picture catch-up mid-gesture, and the edit's frames queued behind it (21 s). An announced export that never goes out stops holding the edit after 5 s; one cancelled as a no-op releases it at once.
8
+
3
9
  ## 0.10.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -6101,6 +6101,7 @@ var MAX_FRAMES_PER_PICTURE = 3;
6101
6101
  var FRAME_SUPERSEDE_GRACE_MS = 2e3;
6102
6102
  var RERENDER_MIN_INTERVAL_MS = 550;
6103
6103
  var EDIT_QUIET_MS = 600;
6104
+ var EXPORT_PENDING_MAX_MS = 5e3;
6104
6105
  function mergeMockupIds(current, extra) {
6105
6106
  const out = [...current];
6106
6107
  for (const id of extra) if (!out.includes(id)) out.push(id);
@@ -6264,6 +6265,7 @@ function RealtimeProvider({
6264
6265
  const pictureViewsRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
6265
6266
  const editLiveRef = (0, import_react25.useRef)(false);
6266
6267
  const editQuietTimerRef = (0, import_react25.useRef)(null);
6268
+ const exportPendingSinceRef = (0, import_react25.useRef)(0);
6267
6269
  const shapeApplyTimerRef = (0, import_react25.useRef)(null);
6268
6270
  const lastShapeRef = (0, import_react25.useRef)(null);
6269
6271
  const applySessionShapeRef = (0, import_react25.useRef)(null);
@@ -6566,6 +6568,7 @@ function RealtimeProvider({
6566
6568
  }
6567
6569
  });
6568
6570
  let settledVersions = 0;
6571
+ let newestSettled = 0;
6569
6572
  const due = dueByVersionRef.current;
6570
6573
  results.forEach((result) => {
6571
6574
  const v = result.requestVersion;
@@ -6575,6 +6578,7 @@ function RealtimeProvider({
6575
6578
  if (entry.due <= 1) {
6576
6579
  due.delete(v);
6577
6580
  settledVersions += 1;
6581
+ newestSettled = Math.max(newestSettled, v);
6578
6582
  } else {
6579
6583
  entry.due -= 1;
6580
6584
  }
@@ -6586,15 +6590,16 @@ function RealtimeProvider({
6586
6590
  if (!pipelineResetCooldownRef.current) {
6587
6591
  hasBlobInFlightRef.current = false;
6588
6592
  for (let i = 0; i < settledVersions; i++) pipelineSettledSubscribersRef.current.forEach((cb) => cb());
6589
- markEditSettled();
6593
+ const exportPending = exportPendingSinceRef.current > 0 && Date.now() - exportPendingSinceRef.current < EXPORT_PENDING_MAX_MS;
6594
+ if (!exportPending && newestSettled >= getLastSentVersion()) markEditSettled();
6590
6595
  }
6591
6596
  } else if (due.size === 0 && hasBlobInFlightRef.current && !hasPendingBlobs() && !pipelineResetCooldownRef.current) {
6592
6597
  hasBlobInFlightRef.current = false;
6593
6598
  pipelineSettledSubscribersRef.current.forEach((cb) => cb());
6594
- markEditSettled();
6599
+ if (!(exportPendingSinceRef.current > 0 && Date.now() - exportPendingSinceRef.current < EXPORT_PENDING_MAX_MS)) markEditSettled();
6595
6600
  }
6596
6601
  },
6597
- [hasPendingBlobs, markEditSettled]
6602
+ [hasPendingBlobs, markEditSettled, getLastSentVersion]
6598
6603
  );
6599
6604
  const runComposite = (0, import_react25.useCallback)(
6600
6605
  async (result) => {
@@ -6710,6 +6715,7 @@ function RealtimeProvider({
6710
6715
  const sendCanvasBlob = (0, import_react25.useCallback)(
6711
6716
  (placement, blob, mockupCount, baseThrottleMs) => {
6712
6717
  blobQueuedGenRef.current = pipelineGenRef.current;
6718
+ exportPendingSinceRef.current = 0;
6713
6719
  const result = sendCanvasBlobRaw(
6714
6720
  placement,
6715
6721
  blob,
@@ -6730,6 +6736,7 @@ function RealtimeProvider({
6730
6736
  const sendCanvasState = (0, import_react25.useCallback)(
6731
6737
  (placement, state, mockupCount, baseThrottleMs) => {
6732
6738
  blobQueuedGenRef.current = pipelineGenRef.current;
6739
+ exportPendingSinceRef.current = 0;
6733
6740
  const result = sendCanvasStateRaw(
6734
6741
  placement,
6735
6742
  state,
@@ -7046,6 +7053,7 @@ function RealtimeProvider({
7046
7053
  );
7047
7054
  const notifyPendingExport = (0, import_react25.useCallback)(
7048
7055
  (placement) => {
7056
+ exportPendingSinceRef.current = Date.now();
7049
7057
  if (pendingPlacementsRef.current.has(placement)) {
7050
7058
  return;
7051
7059
  }
@@ -7067,6 +7075,8 @@ function RealtimeProvider({
7067
7075
  );
7068
7076
  const notifyPendingExportCancelled = (0, import_react25.useCallback)(
7069
7077
  (placement) => {
7078
+ exportPendingSinceRef.current = 0;
7079
+ markEditSettled();
7070
7080
  if (!pendingPlacementsRef.current.has(placement)) {
7071
7081
  return;
7072
7082
  }
@@ -7087,7 +7097,7 @@ function RealtimeProvider({
7087
7097
  );
7088
7098
  pendingExportCancelledSubscribersRef.current.forEach((cb) => cb(placement));
7089
7099
  },
7090
- [productContext?.product?.mockups]
7100
+ [productContext?.product?.mockups, markEditSettled]
7091
7101
  );
7092
7102
  const getMockupUrl3 = (0, import_react25.useCallback)((mockupId) => {
7093
7103
  if (pendingMockupIdsRef.current.has(mockupId)) {