@kodiak-finance/orderly-hooks 2.8.17 → 2.8.18-rc.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/dist/index.js CHANGED
@@ -3244,15 +3244,14 @@ var CalculatorService = class {
3244
3244
  this.referenceCount.delete(ref_count_name);
3245
3245
  }
3246
3246
  async calc(scope, data, options) {
3247
- if (scope !== "position" /* POSITION */) {
3248
- if (!options?.skipWhenOnPause) ;
3249
- }
3247
+ const isVisible = this.windowIsVisible;
3250
3248
  const ctx = CalculatorContext.create(scope, data);
3251
3249
  if (!ctx.isReady && options?.skipPending) {
3252
3250
  return;
3253
3251
  }
3254
- if (options?.skipWhenOnPause && !this.windowIsVisible)
3252
+ if (options?.skipWhenOnPause && !isVisible) {
3255
3253
  return;
3254
+ }
3256
3255
  this.calcQueue.push({ scope, data, options });
3257
3256
  await this.handleCalcQueue(ctx);
3258
3257
  this.ctx = ctx;
@@ -10003,8 +10002,8 @@ var usePrivateDataObserver = (options) => {
10003
10002
  formatter: (data) => data,
10004
10003
  onError: (error) => {
10005
10004
  statusActions.updateApiError("positions", error.message);
10006
- }
10007
- // revalidateOnFocus: false,
10005
+ },
10006
+ revalidateOnFocus: false
10008
10007
  });
10009
10008
  React2.useEffect(() => {
10010
10009
  const handler = (state2) => {
@@ -10026,14 +10025,16 @@ var usePrivateDataObserver = (options) => {
10026
10025
  }, [isPositionLoading, statusActions]);
10027
10026
  React2.useEffect(() => {
10028
10027
  if (positions3 && Array.isArray(positions3.rows)) {
10029
- calculatorService.calc("position" /* POSITION */, positions3);
10028
+ calculatorService.calc("position" /* POSITION */, positions3, {
10029
+ skipWhenOnPause: true
10030
+ });
10030
10031
  }
10031
10032
  }, [calculatorService, positions3]);
10032
10033
  const { data: holding } = usePrivateQuery(
10033
10034
  "/v1/client/holding",
10034
10035
  {
10035
- formatter: (data) => data.holding
10036
- // revalidateOnFocus: false,
10036
+ formatter: (data) => data.holding,
10037
+ revalidateOnFocus: false
10037
10038
  }
10038
10039
  );
10039
10040
  React2.useEffect(() => {
@@ -10050,7 +10051,13 @@ var usePrivateDataObserver = (options) => {
10050
10051
  onMessage: (data) => {
10051
10052
  const holding2 = data?.balances ?? {};
10052
10053
  if (holding2) {
10053
- calculatorService.calc("portfolio" /* PORTFOLIO */, { holding: holding2 });
10054
+ calculatorService.calc(
10055
+ "portfolio" /* PORTFOLIO */,
10056
+ { holding: holding2 },
10057
+ {
10058
+ skipWhenOnPause: true
10059
+ }
10060
+ );
10054
10061
  }
10055
10062
  }
10056
10063
  }
@@ -10066,7 +10073,13 @@ var usePrivateDataObserver = (options) => {
10066
10073
  return;
10067
10074
  }
10068
10075
  if (isHoldingInit.current) {
10069
- calculatorService.calc("portfolio" /* PORTFOLIO */, { holding });
10076
+ calculatorService.calc(
10077
+ "portfolio" /* PORTFOLIO */,
10078
+ { holding },
10079
+ {
10080
+ skipWhenOnPause: true
10081
+ }
10082
+ );
10070
10083
  } else {
10071
10084
  restoreHolding(holding);
10072
10085
  }