diff --git a/frontend/src/components/TicketActionButtons/index.js b/frontend/src/components/TicketActionButtons/index.js index 8f69d43..c066113 100644 --- a/frontend/src/components/TicketActionButtons/index.js +++ b/frontend/src/components/TicketActionButtons/index.js @@ -31,11 +31,22 @@ const useStyles = makeStyles(theme => ({ const TicketActionButtons = ({ ticket, statusChatEnd }) => { const classes = useStyles(); - const history = useHistory(); + const history = useHistory(); const [anchorEl, setAnchorEl] = useState(null); const [loading, setLoading] = useState(false); - const [useDialogflow, setUseDialogflow] = useState(ticket.contact.useDialogflow); + + // const [useDialogflow, setUseDialogflow] = useState(ticket.contact.useDialogflow); + + const [useDialogflow, setUseDialogflow] = useState(() => { + if (Object.keys(ticket).length != 0) { + return ticket.contact.useDialogflow; + } else { + // Set a default value if `ticket.contact.useDialogflow` is null + return true + } + }); + const ticketOptionsMenuOpen = Boolean(anchorEl); const { user } = useContext(AuthContext);