Skip to content

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

fix: reset stale local state in change request ui

Scott Wilson90b757542ee4
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/SecretApprovalRequest.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/SecretApprovalRequest.tsx
index f9a228d3c4..7bbc28a726 100644
--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/SecretApprovalRequest.tsx
+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/SecretApprovalRequest.tsx
@@ -111,7 +111,13 @@ const FilterMenu = ({
const selectedOption = options.find((option) => option.value === value);
return (
- <Popover open={isOpen} onOpenChange={setIsOpen}>
+ <Popover
+ open={isOpen}
+ onOpenChange={(open) => {
+ setIsOpen(open);
+ if (!open) setInputValue("");
+ }}
+ >
<PopoverTrigger asChild>
<Button
variant="outline"
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestChanges.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestChanges.tsx
index 2afca070de..a2d2b85dcf 100644
--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestChanges.tsx
+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestChanges.tsx
@@ -1,5 +1,5 @@
/* eslint-disable no-nested-ternary */
-import { Fragment, useState } from "react";
+import { Fragment, useEffect, useState } from "react";
import { format } from "date-fns";
import {
BanIcon,
@@ -143,6 +143,13 @@ export const SecretApprovalRequestChanges = ({
const [willMerge, setWillMerge] = useState(false);
const [isEditingReview, setIsEditingReview] = useState(false);
+ // Reset the review draft whenever the request changes (or the sheet closes, which
+ // sets approvalRequestId to "") so state never carries over to a different request.
+ useEffect(() => {
+ setComment("");
+ setIsEditingReview(false);
+ }, [approvalRequestId]);
+
const { data: secretApprovalRequestDetails, isPending: isLoading } =
useGetSecretApprovalRequestDetails({
id: approvalRequestId,