Refresh automation data shown by edit automation card after update

Previously required the automation page to be refreshed to see updates
to the automation in the edit automation card. This would be seen when
user tries to edit an automation multiple times (without a page refresh)
This commit is contained in:
Debanjum Singh Solanky 2024-08-11 15:14:19 +05:30
parent f2f37ae444
commit 16b31c3e35

View file

@ -324,7 +324,7 @@ function AutomationsCard(props: AutomationsCardProps) {
setNewAutomationData={setUpdatedAutomationData}
authenticatedData={props.authenticatedData}
isCreating={isEditing}
automation={automation}
automation={updatedAutomationData || automation}
ipLocationData={props.locationData}
/>
)}
@ -500,19 +500,14 @@ function EditCard(props: EditCardProps) {
);
let updateQueryUrl = `/api/automation?`;
updateQueryUrl += `q=${values.queryToRun}`;
if (automation?.id && !props.createNew) {
updateQueryUrl += `&automation_id=${automation.id}`;
}
if (values.subject) {
updateQueryUrl += `&subject=${values.subject}`;
}
updateQueryUrl += `&crontime=${cronFrequency}`;
if (props.locationData) {
updateQueryUrl += `&city=${props.locationData.city}`;
updateQueryUrl += `&region=${props.locationData.region}`;
@ -978,7 +973,6 @@ export default function Automations() {
const [suggestedAutomations, setSuggestedAutomations] = useState<AutomationsData[]>([]);
const [showLoginPrompt, setShowLoginPrompt] = useState(false);
const isMobileWidth = useIsMobileWidth();
const ipLocationData = useIPLocationData();
useEffect(() => {