@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.mjs CHANGED
@@ -3219,15 +3219,14 @@ var CalculatorService = class {
3219
3219
  this.referenceCount.delete(ref_count_name);
3220
3220
  }
3221
3221
  async calc(scope, data, options) {
3222
- if (scope !== "position" /* POSITION */) {
3223
- if (!options?.skipWhenOnPause) ;
3224
- }
3222
+ const isVisible = this.windowIsVisible;
3225
3223
  const ctx = CalculatorContext.create(scope, data);
3226
3224
  if (!ctx.isReady && options?.skipPending) {
3227
3225
  return;
3228
3226
  }
3229
- if (options?.skipWhenOnPause && !this.windowIsVisible)
3227
+ if (options?.skipWhenOnPause && !isVisible) {
3230
3228
  return;
3229
+ }
3231
3230
  this.calcQueue.push({ scope, data, options });
3232
3231
  await this.handleCalcQueue(ctx);
3233
3232
  this.ctx = ctx;
@@ -9978,8 +9977,8 @@ var usePrivateDataObserver = (options) => {
9978
9977
  formatter: (data) => data,
9979
9978
  onError: (error) => {
9980
9979
  statusActions.updateApiError("positions", error.message);
9981
- }
9982
- // revalidateOnFocus: false,
9980
+ },
9981
+ revalidateOnFocus: false
9983
9982
  });
9984
9983
  useEffect(() => {
9985
9984
  const handler = (state2) => {
@@ -10001,14 +10000,16 @@ var usePrivateDataObserver = (options) => {
10001
10000
  }, [isPositionLoading, statusActions]);
10002
10001
  useEffect(() => {
10003
10002
  if (positions3 && Array.isArray(positions3.rows)) {
10004
- calculatorService.calc("position" /* POSITION */, positions3);
10003
+ calculatorService.calc("position" /* POSITION */, positions3, {
10004
+ skipWhenOnPause: true
10005
+ });
10005
10006
  }
10006
10007
  }, [calculatorService, positions3]);
10007
10008
  const { data: holding } = usePrivateQuery(
10008
10009
  "/v1/client/holding",
10009
10010
  {
10010
- formatter: (data) => data.holding
10011
- // revalidateOnFocus: false,
10011
+ formatter: (data) => data.holding,
10012
+ revalidateOnFocus: false
10012
10013
  }
10013
10014
  );
10014
10015
  useEffect(() => {
@@ -10025,7 +10026,13 @@ var usePrivateDataObserver = (options) => {
10025
10026
  onMessage: (data) => {
10026
10027
  const holding2 = data?.balances ?? {};
10027
10028
  if (holding2) {
10028
- calculatorService.calc("portfolio" /* PORTFOLIO */, { holding: holding2 });
10029
+ calculatorService.calc(
10030
+ "portfolio" /* PORTFOLIO */,
10031
+ { holding: holding2 },
10032
+ {
10033
+ skipWhenOnPause: true
10034
+ }
10035
+ );
10029
10036
  }
10030
10037
  }
10031
10038
  }
@@ -10041,7 +10048,13 @@ var usePrivateDataObserver = (options) => {
10041
10048
  return;
10042
10049
  }
10043
10050
  if (isHoldingInit.current) {
10044
- calculatorService.calc("portfolio" /* PORTFOLIO */, { holding });
10051
+ calculatorService.calc(
10052
+ "portfolio" /* PORTFOLIO */,
10053
+ { holding },
10054
+ {
10055
+ skipWhenOnPause: true
10056
+ }
10057
+ );
10045
10058
  } else {
10046
10059
  restoreHolding(holding);
10047
10060
  }