@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.esm.js CHANGED
@@ -2555,9 +2555,22 @@ var init_KeyFormDialog = __esm({
2555
2555
  setCloseWithoutCopyConfirm(false);
2556
2556
  setTouched({});
2557
2557
  setSubmitAttempted(false);
2558
- onGetConfig().then(setConfig).catch(() => setConfig(null));
2559
2558
  }
2560
- }, [open, isCreate, keyToEdit, username, keyGenerationSettings?.allowUnlimitedBudget, onGetConfig]);
2559
+ }, [open, isCreate, keyToEdit, username, keyGenerationSettings?.allowUnlimitedBudget]);
2560
+ const onGetConfigRef = useRef3(onGetConfig);
2561
+ onGetConfigRef.current = onGetConfig;
2562
+ useEffect3(() => {
2563
+ if (!open) return void 0;
2564
+ let cancelled = false;
2565
+ onGetConfigRef.current().then((c) => {
2566
+ if (!cancelled) setConfig(c);
2567
+ }).catch(() => {
2568
+ if (!cancelled) setConfig(null);
2569
+ });
2570
+ return () => {
2571
+ cancelled = true;
2572
+ };
2573
+ }, [open]);
2561
2574
  const allowUnlimitedBudget = keyGenerationSettings?.allowUnlimitedBudget ?? false;
2562
2575
  const teamRequired = keyGenerationSettings?.teamRequired ?? true;
2563
2576
  const formData = isCreate ? generateForm : editFormState;
@@ -6089,6 +6102,7 @@ var init_LiteLLMPage = __esm({
6089
6102
  ]);
6090
6103
  return allModels.filter((m) => allowed.has(m.model_name));
6091
6104
  }, [allModels, userInfo, teams]);
6105
+ const getConfig = useCallback4(() => api.getConfig(), [api]);
6092
6106
  const handleGenerateKey = useCallback4(
6093
6107
  async (request) => {
6094
6108
  try {
@@ -6414,7 +6428,7 @@ var init_LiteLLMPage = __esm({
6414
6428
  onCreateKey: handleGenerateKey,
6415
6429
  onUpdateKey: handleUpdateKey,
6416
6430
  onResetKeySpend: handleResetKeySpend,
6417
- onGetConfig: () => api.getConfig()
6431
+ onGetConfig: getConfig
6418
6432
  }
6419
6433
  ),
6420
6434
  /* @__PURE__ */ jsx18(