diff --git a/web/src/app/app/datasets/[datasetId]/_DatasetPageContext.tsx b/web/src/app/app/datasets/[datasetId]/_DatasetPageContext.tsx
index 375186938..5bba7327c 100644
--- a/web/src/app/app/datasets/[datasetId]/_DatasetPageContext.tsx
+++ b/web/src/app/app/datasets/[datasetId]/_DatasetPageContext.tsx
@@ -14,7 +14,7 @@ import { useDeployDataset } from '@/api/busterv2';
export const useDatasetPageContext = ({ datasetId }: { datasetId: string }) => {
const segments = useSelectedLayoutSegment() as DatasetApps;
- const { mutate: onUpdateDataset } = useDeployDataset();
+ const { mutate: onUpdateDataset, isPending: isDeployingDataset } = useDeployDataset();
const { dataset, datasetData } = useIndividualDataset({ datasetId });
const originalDatasetSQL = dataset?.data?.sql;
const datasetYmlFile = dataset?.data?.yml_file;
@@ -27,7 +27,7 @@ export const useDatasetPageContext = ({ datasetId }: { datasetId: string }) => {
const disablePublish = useMemo(() => {
const originalSQL = datasetSQL || '';
const originalYmlFile = datasetYmlFile || '';
- return !datasetId || !sql || originalSQL === sql || !ymlFile || originalYmlFile === ymlFile;
+ return !datasetId || !sql || !ymlFile || (originalYmlFile === ymlFile && originalSQL === sql);
}, [datasetSQL, sql, datasetId, datasetYmlFile, ymlFile]);
const isChangedSQL = useMemo(() => {
@@ -40,10 +40,11 @@ export const useDatasetPageContext = ({ datasetId }: { datasetId: string }) => {
});
const onPublishDataset = useMemoizedFn(async () => {
+ if (disablePublish || !sql || !ymlFile) return;
onUpdateDataset({
dataset_id: datasetId!,
- sql: sql!,
- yml: ymlFile!
+ sql: sql,
+ yml: ymlFile
});
});
@@ -69,7 +70,8 @@ export const useDatasetPageContext = ({ datasetId }: { datasetId: string }) => {
dataset,
disablePublish,
isChangedSQL,
- datasetId
+ datasetId,
+ isDeployingDataset
};
};
diff --git a/web/src/app/app/datasets/[datasetId]/_DatasetsIndividualHeader/DatasetsIndividualHeader.tsx b/web/src/app/app/datasets/[datasetId]/_DatasetsIndividualHeader/DatasetsIndividualHeader.tsx
index 417f5d02a..3e1a6f9aa 100644
--- a/web/src/app/app/datasets/[datasetId]/_DatasetsIndividualHeader/DatasetsIndividualHeader.tsx
+++ b/web/src/app/app/datasets/[datasetId]/_DatasetsIndividualHeader/DatasetsIndividualHeader.tsx
@@ -17,6 +17,7 @@ export const DatasetsIndividualHeader: React.FC<{}> = React.memo(({}) => {
const selectedApp = useDatasetPageContextSelector((state) => state.selectedApp);
const dataset = useDatasetPageContextSelector((state) => state.dataset);
const onPublishDataset = useDatasetPageContextSelector((state) => state.onPublishDataset);
+ const isDeployingDataset = useDatasetPageContextSelector((state) => state.isDeployingDataset);
const resetDataset = useDatasetPageContextSelector((state) => state.resetDataset);
const disablePublish = useDatasetPageContextSelector((state) => state.disablePublish);
const isChangedSQL = useDatasetPageContextSelector((state) => state.isChangedSQL);
@@ -25,7 +26,6 @@ export const DatasetsIndividualHeader: React.FC<{}> = React.memo(({}) => {
const datasetName = dataset?.data?.name;
const isAdmin = useUserConfigContextSelector((state) => state.isAdmin);
- const setOpenNewDatasetModal = useDatasetContextSelector((state) => state.setOpenNewDatasetModal);
const preventNavigation = !disablePublish;
@@ -59,10 +59,14 @@ export const DatasetsIndividualHeader: React.FC<{}> = React.memo(({}) => {