@veltdev/react 4.5.2-beta.11 → 4.5.2-beta.12

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.
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export declare const VELT_SDK_VERSION = "4.5.2-beta.11";
2
+ export declare const VELT_SDK_VERSION = "4.5.2-beta.12";
3
3
  export declare const VELT_SDK_INIT_EVENT = "onVeltInit";
4
4
  export declare const VELT_TAB_ID = "veltTabId";
5
5
  export declare const INTEGRITY_MAP: Record<string, string>;
package/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import React, { createContext, useContext, useState, useEffect, useRef, useMemo } from 'react';
2
+ import { flushSync } from 'react-dom';
2
3
 
3
4
  /******************************************************************************
4
5
  Copyright (c) Microsoft Corporation.
@@ -136,13 +137,13 @@ var loadVelt = function (callback, version, staging, develop, proxyDomain, integ
136
137
  }
137
138
  };
138
139
 
139
- var VELT_SDK_VERSION = '4.5.2-beta.11';
140
+ var VELT_SDK_VERSION = '4.5.2-beta.12';
140
141
  var VELT_SDK_INIT_EVENT = 'onVeltInit';
141
142
  var VELT_TAB_ID = 'veltTabId';
142
143
  // integrity map for the Velt SDK
143
144
  // Note: generate integrity hashes with: https://www.srihash.org/
144
145
  var INTEGRITY_MAP = {
145
- '4.5.2-beta.11': 'sha384-zlXomcC9rDwpcmKm3m5xVdanWaZNX/TlUXH7Sa94bqjIGhJjHlwxEU8KcIeosOa0',
146
+ '4.5.2-beta.12': 'sha384-yrQgLPkPfx83/uzsQqXaW7ABGl2SMqLGKRnxfYHze796JB2QC1poRP28MhHE8LA3',
146
147
  };
147
148
 
148
149
  var SnippylyProvider = function (props) {
@@ -6795,7 +6796,14 @@ function useVeltEventCallback(action) {
6795
6796
  subscriptionRef.current.unsubscribe();
6796
6797
  }
6797
6798
  var subscription = (_a = client === null || client === void 0 ? void 0 : client.on(memoizedAction)) === null || _a === void 0 ? void 0 : _a.subscribe(function (data) {
6798
- setData(data);
6799
+ if (memoizedAction === 'initUpdate') {
6800
+ flushSync(function () {
6801
+ setData(data);
6802
+ });
6803
+ }
6804
+ else {
6805
+ setData(data);
6806
+ }
6799
6807
  });
6800
6808
  // Store the new subscription
6801
6809
  subscriptionRef.current = subscription;