Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Merge remote-tracking branch 'origin/main' into AGE2-130

Scott Wilson8e6935326866
diff --cc frontend/src/components/agent-vault/service-sheet/ServiceSheet.tsx
index b147871a8f,cf6f15fef4..85cff341e2
--- a/frontend/src/components/agent-vault/service-sheet/ServiceSheet.tsx
+++ b/frontend/src/components/agent-vault/service-sheet/ServiceSheet.tsx
@@@ -201,37 -197,14 +201,43 @@@ export const ServiceSheet = (
formState: { errors, isDirty, isSubmitting }
} = formMethods;
+ // Only the keys the form references are looked up, never the whole list.
+ const [secret, username, customHeaders, substitutions] = useWatch({
+ control,
+ name: ["secret", "username", "customHeaders", "substitutions"]
+ });
+ const referencedKeys = useMemo(() => {
+ const texts = [
+ secret,
+ username,
+ ...(customHeaders ?? []).map((header) => header.value),
+ ...(substitutions ?? []).map((substitution) => substitution.value)
+ ];
+ const keys = texts.flatMap((text) =>
+ text && text !== UNCHANGED_SECRET ? findVariableReferences(text) : []
+ );
+ return [...new Set(keys.filter((key) => VARIABLE_KEY_RE.test(key)))].sort().join(",");
+ }, [secret, username, customHeaders, substitutions]);
+ const [debouncedReferencedKeys] = useDebounce(referencedKeys, 300);
+ const { missing: missingKeys } = useAgentVaultVariableKeyStatus(
+ debouncedReferencedKeys ? debouncedReferencedKeys.split(",") : [],
+ isOpen
+ );
+ missingKeysRef.current = missingKeys;
+
+ const serviceVariables = useMemo(
+ () => ({ missingKeys, storedKeys, requestVariable }),
+ [missingKeys, storedKeys, requestVariable]
+ );
+
+ const discardActionRef = useRef<VoidFunction>(() => onOpenChange(false));
const { confirmDiscard, isDiscardDialogOpen, requestDiscard, setIsDiscardDialogOpen } =
- useDiscardChangesGuard({ isDirty, onDiscard: () => onOpenChange(false) });
+ useDiscardChangesGuard({ isDirty, onDiscard: () => discardActionRef.current() });
+
+ const requestDiscardAction = (action: VoidFunction) => {
+ discardActionRef.current = action;
+ requestDiscard();
+ };
// A prefilled host has already been matched against the templates, and anything picked on the
// template step would replace that host.