mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
fix: update form reset conditions in environment and compose file editors
- Modified the reset logic in ShowEnvironment to only reset when there are no changes. - Adjusted the reset condition in ComposeFileEditor to check if composeFile is empty before resetting. - Cleaned up the query in the compose service page by removing unnecessary refetchInterval.
This commit is contained in:
@@ -49,7 +49,7 @@ export const ShowEnvironment = ({ applicationId }: Props) => {
|
|||||||
currentBuildArgs !== (data?.buildArgs || "");
|
currentBuildArgs !== (data?.buildArgs || "");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (data) {
|
if (data && !hasChanges) {
|
||||||
form.reset({
|
form.reset({
|
||||||
env: data.env || "",
|
env: data.env || "",
|
||||||
buildArgs: data.buildArgs || "",
|
buildArgs: data.buildArgs || "",
|
||||||
|
|||||||
@@ -44,8 +44,10 @@ export const ComposeFileEditor = ({ composeId }: Props) => {
|
|||||||
resolver: zodResolver(AddComposeFile),
|
resolver: zodResolver(AddComposeFile),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const composeFile = form.watch("composeFile");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (data) {
|
if (data && !composeFile) {
|
||||||
form.reset({
|
form.reset({
|
||||||
composeFile: data.composeFile || "",
|
composeFile: data.composeFile || "",
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -74,12 +74,7 @@ const Service = (
|
|||||||
}
|
}
|
||||||
}, [router.query.tab]);
|
}, [router.query.tab]);
|
||||||
|
|
||||||
const { data } = api.compose.one.useQuery(
|
const { data } = api.compose.one.useQuery({ composeId });
|
||||||
{ composeId },
|
|
||||||
{
|
|
||||||
refetchInterval: 5000,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
const { data: auth } = api.user.get.useQuery();
|
const { data: auth } = api.user.get.useQuery();
|
||||||
const { data: isCloud } = api.settings.isCloud.useQuery();
|
const { data: isCloud } = api.settings.isCloud.useQuery();
|
||||||
|
|||||||
Reference in New Issue
Block a user