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