Skip to content

Commit

Permalink
[Fix] DRC-978 Reset the current code when Modal is opened
Browse files Browse the repository at this point in the history
Signed-off-by: Kent Huang <[email protected]>
  • Loading branch information
kentwelcome committed Dec 24, 2024
1 parent 1ccefd8 commit 8ff664b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion js/src/components/lineage/PreviewChangeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { QueryParams, submitQueryDiff } from "@/lib/api/adhocQuery";
import { SubmitOptions, waitRun } from "@/lib/api/runs";
import { useRecceActionContext } from "@/lib/hooks/RecceActionContext";
import { useMutation } from "@tanstack/react-query";
import { useState } from "react";
import { useEffect, useState } from "react";
import { QueryForm } from "../query/QueryForm";
import { AiOutlineExperiment } from "react-icons/ai";
import { useFeedbackCollectionToast } from "@/lib/hooks/useFeedbackCollectionToast";
Expand Down Expand Up @@ -187,6 +187,12 @@ export function PreviewChangeView({
externalLinkText: "Give us feedback",
});

useEffect(() => {
if (isOpen) {
setModifiedCode(current?.raw_code || "");
}
}, [isOpen, current]);

return (
<Modal
isOpen={isOpen}
Expand Down

0 comments on commit 8ff664b

Please sign in to comment.