@orderly.network/hooks 2.0.1-alpha.2 → 2.0.1-alpha.3

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.d.mts CHANGED
@@ -27,7 +27,7 @@ declare global {
27
27
  };
28
28
  }
29
29
  }
30
- declare const _default: "2.0.1-alpha.2";
30
+ declare const _default: "2.0.1-alpha.3";
31
31
 
32
32
  type useQueryOptions<T> = SWRConfiguration & {
33
33
  formatter?: (data: any) => T;
package/dist/index.d.ts CHANGED
@@ -27,7 +27,7 @@ declare global {
27
27
  };
28
28
  }
29
29
  }
30
- declare const _default: "2.0.1-alpha.2";
30
+ declare const _default: "2.0.1-alpha.3";
31
31
 
32
32
  type useQueryOptions<T> = SWRConfiguration & {
33
33
  formatter?: (data: any) => T;
package/dist/index.js CHANGED
@@ -40,9 +40,9 @@ var __export = (target, all) => {
40
40
  // src/version.ts
41
41
  if (typeof window !== "undefined") {
42
42
  window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
43
- window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.0.1-alpha.2";
43
+ window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.0.1-alpha.3";
44
44
  }
45
- var version_default = "2.0.1-alpha.2";
45
+ var version_default = "2.0.1-alpha.3";
46
46
  var fetcher = (url, init = {}, queryOptions) => net.get(url, init, queryOptions?.formatter);
47
47
  var OrderlyContext = React.createContext({
48
48
  // configStore: new MemoryConfigStore(),
@@ -13733,7 +13733,7 @@ var useOrderEntry2 = (symbol, options) => {
13733
13733
  throw new Error("symbol is required and must be a string");
13734
13734
  }
13735
13735
  const ee = useEventEmitter();
13736
- const fieldDirty = React.useRef({});
13736
+ React.useRef({});
13737
13737
  const [meta, setMeta] = React.useState({
13738
13738
  dirty: {},
13739
13739
  submitted: false,
@@ -13817,11 +13817,17 @@ var useOrderEntry2 = (symbol, options) => {
13817
13817
  return true;
13818
13818
  };
13819
13819
  const setValue = (key, value, options2) => {
13820
- const { shouldUpdateLastChangedField = true } = options2 || {};
13820
+ const { shouldUpdateLastChangedField = true, shouldUpdateDirty = true } = options2 || {};
13821
13821
  if (!canSetTPSLPrice(key, formattedOrder.order_type)) {
13822
13822
  return;
13823
13823
  }
13824
- fieldDirty.current[key] = true;
13824
+ if (shouldUpdateDirty) {
13825
+ setMeta(
13826
+ immer$1.produce((draft) => {
13827
+ draft.dirty[key] = true;
13828
+ })
13829
+ );
13830
+ }
13825
13831
  const values2 = setValueInternal(key, value, prepareData());
13826
13832
  if (values2) {
13827
13833
  interactiveValidate(values2);