Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix(insights): keep value search results until the next search
Calvinb0fbd30ba8ec
diff --git a/frontend/src/components/secrets/SecretValueSearchSheet.tsx b/frontend/src/components/secrets/SecretValueSearchSheet.tsxindex 99384d5281..c89f0007f9 100644--- a/frontend/src/components/secrets/SecretValueSearchSheet.tsx+++ b/frontend/src/components/secrets/SecretValueSearchSheet.tsx@@ -76,7 +76,14 @@ const SearchContent = ({ orgId, onClose }: { orgId: string; onClose: () => voidconst handleSubmit = (event: FormEvent) => {event.preventDefault();if (!value || search.isPending) return;- search.mutate({ secretValue: value }, { onSuccess: (data) => setMatches(data.secrets) });+ search.mutate(+ { secretValue: value },+ {+ onSuccess: (data) => setMatches(data.secrets),+ // A failed search must not leave the previous value's results looking like its answer.+ onError: () => setMatches(null)+ }+ );};const renderResults = () => {@@ -189,12 +196,7 @@ const SearchContent = ({ orgId, onClose }: { orgId: string; onClose: () => voidcontainerClassName="flex-1"placeholder="Paste the full secret value..."value={value}- onChange={(e) => {- setValue(e.target.value);- // Results belong to the value that was searched, not the one now in the box.- setMatches(null);- search.reset();- }}+ onChange={(e) => setValue(e.target.value)}onKeyDown={(e) => {// A textarea would otherwise take Enter as a newline rather than a search.if (e.key === "Enter" && !e.shiftKey) {