Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove alteredNodes badge on publish button and validateAndDiff request on first flow load #4032

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Badge from "@mui/material/Badge";
import Box from "@mui/material/Box";
import Button from "@mui/material/Button";
import Dialog from "@mui/material/Dialog";
Expand Down Expand Up @@ -98,35 +97,21 @@ export const PublishFlowButton: React.FC<{ previewURL: string }> = ({
setLastPublishedTitle(formatLastPublishMessage(date, user));
}, [flowId]);

const _validateAndDiffRequest = useAsync(async () => {
const newChanges = await validateAndDiffFlow(flowId);
setAlteredNodes(
newChanges?.data.alteredNodes ? newChanges.data.alteredNodes : [],
);
}, [flowId]);

// useStore.getState().getTeam().slug undefined here, use window instead
const teamSlug = window.location.pathname.split("/")[1];

return (
<Box width="100%" mt={2}>
<Box display="flex" flexDirection="column" alignItems="flex-end">
<Badge
<Button
sx={{ width: "100%" }}
badgeContent={alteredNodes && alteredNodes.length}
max={999}
color="warning"
variant="contained"
color="primary"
disabled={!useStore.getState().canUserEditTeam(teamSlug)}
onClick={handleCheckForChangesToPublish}
>
<Button
sx={{ width: "100%" }}
variant="contained"
color="primary"
disabled={!useStore.getState().canUserEditTeam(teamSlug)}
onClick={handleCheckForChangesToPublish}
>
CHECK FOR CHANGES TO PUBLISH
</Button>
</Badge>
CHECK FOR CHANGES TO PUBLISH
</Button>
<Dialog
open={dialogOpen}
onClose={() => setDialogOpen(false)}
Expand Down
Loading