@eddyskywalker/dsh-chatgpt-subscription 0.10.5 → 0.10.6

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/lib/client.js CHANGED
@@ -6497,12 +6497,17 @@ window.__ModuleLoader__.load({
6497
6497
  const [contextDrafts, setContextDrafts] = (0, react.useState)({});
6498
6498
  const [savingModel, setSavingModel] = (0, react.useState)(null);
6499
6499
  const [pool, setPool] = (0, react.useState)(void 0);
6500
+ const quotaFollowUp = (0, react.useRef)(void 0);
6500
6501
  const loadStatus = (0, react.useCallback)(async (quiet = false) => {
6501
6502
  if (!quiet) setError(null);
6502
6503
  try {
6503
6504
  const next = await get("/status");
6504
6505
  setStatus(next);
6505
6506
  setContextDrafts(contextDraftsFor$1(next));
6507
+ quotaFollowUp.current ??= createQuotaFollowUp();
6508
+ quotaFollowUp.current.observe(next.quotaRefreshing === true, () => {
6509
+ loadStatus(true);
6510
+ });
6506
6511
  } catch (cause) {
6507
6512
  if (!quiet) setError(messageOf(cause));
6508
6513
  } finally {
@@ -6523,6 +6528,7 @@ window.__ModuleLoader__.load({
6523
6528
  return () => {
6524
6529
  window.clearInterval(timer);
6525
6530
  document.removeEventListener("visibilitychange", refreshWhenVisible);
6531
+ quotaFollowUp.current?.cancel();
6526
6532
  };
6527
6533
  }, [loadStatus]);
6528
6534
  const loginId = flow?.loginId;