@kodiak-finance/orderly-hooks 2.8.18-rc.1 → 2.8.18

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