@acarmisc/backstage-plugin-litellm 0.31.0 → 0.31.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.cjs.js CHANGED
@@ -2575,9 +2575,22 @@ var init_KeyFormDialog = __esm({
2575
2575
  setCloseWithoutCopyConfirm(false);
2576
2576
  setTouched({});
2577
2577
  setSubmitAttempted(false);
2578
- onGetConfig().then(setConfig).catch(() => setConfig(null));
2579
2578
  }
2580
- }, [open, isCreate, keyToEdit, username, keyGenerationSettings?.allowUnlimitedBudget, onGetConfig]);
2579
+ }, [open, isCreate, keyToEdit, username, keyGenerationSettings?.allowUnlimitedBudget]);
2580
+ const onGetConfigRef = (0, import_react6.useRef)(onGetConfig);
2581
+ onGetConfigRef.current = onGetConfig;
2582
+ (0, import_react6.useEffect)(() => {
2583
+ if (!open) return void 0;
2584
+ let cancelled = false;
2585
+ onGetConfigRef.current().then((c) => {
2586
+ if (!cancelled) setConfig(c);
2587
+ }).catch(() => {
2588
+ if (!cancelled) setConfig(null);
2589
+ });
2590
+ return () => {
2591
+ cancelled = true;
2592
+ };
2593
+ }, [open]);
2581
2594
  const allowUnlimitedBudget = keyGenerationSettings?.allowUnlimitedBudget ?? false;
2582
2595
  const teamRequired = keyGenerationSettings?.teamRequired ?? true;
2583
2596
  const formData = isCreate ? generateForm : editFormState;
@@ -6073,6 +6086,7 @@ var init_LiteLLMPage = __esm({
6073
6086
  ]);
6074
6087
  return allModels.filter((m) => allowed.has(m.model_name));
6075
6088
  }, [allModels, userInfo, teams]);
6089
+ const getConfig = (0, import_react13.useCallback)(() => api.getConfig(), [api]);
6076
6090
  const handleGenerateKey = (0, import_react13.useCallback)(
6077
6091
  async (request) => {
6078
6092
  try {
@@ -6398,7 +6412,7 @@ var init_LiteLLMPage = __esm({
6398
6412
  onCreateKey: handleGenerateKey,
6399
6413
  onUpdateKey: handleUpdateKey,
6400
6414
  onResetKeySpend: handleResetKeySpend,
6401
- onGetConfig: () => api.getConfig()
6415
+ onGetConfig: getConfig
6402
6416
  }
6403
6417
  ),
6404
6418
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(