Skip to content

Commit 57c1e76

Browse files
committed
fix(generator query): clear generator query after succussful download
1 parent fa16948 commit 57c1e76

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

web/src/features/terraform/Terraform.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { Link, Outlet } from "react-router-dom";
77

88
const Terraform = () => {
99
const { endpoint, isSuccess } = useGptStore((s) => s.generatorQuery);
10+
const setGeneratorQuery = useGptStore((s) => s.setGeneratorQuery);
1011

1112
const downloadRef = useRef<HTMLAnchorElement>(null);
1213

@@ -17,13 +18,15 @@ const Terraform = () => {
1718
if (downloadRef.current) {
1819
downloadRef.current.href = Endpoints.DOWNLOAD_LINK;
1920
downloadRef.current.download = "media";
21+
downloadRef.current.target = "_blank";
2022
downloadRef.current.click();
2123
}
2224
}, [isSuccess, endpoint]);
2325

2426
useEffect(() => {
2527
if (isSuccess) {
2628
downloadFile();
29+
setGeneratorQuery(false, "");
2730
}
2831
}, [isSuccess, endpoint]);
2932

0 commit comments

Comments
 (0)