Skip to content

Commit

Permalink
fix: remove alteredNodes badge on publish button and `validateAndDi…
Browse files Browse the repository at this point in the history
…ff` request on first flow load (#4032)
  • Loading branch information
jessicamcinchak authored Dec 4, 2024
1 parent 21a0213 commit a226423
Showing 1 changed file with 7 additions and 22 deletions.
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

0 comments on commit a226423

Please sign in to comment.