fix(shareModal/index.tsx): make handleShareComponent function asynchronous to ensure proper flow saving before saving flow store

This commit is contained in:
cristhianzl 2023-12-08 15:51:42 -03:00
commit 79d7d4ad4b

View file

@ -92,7 +92,7 @@ export default function ShareModal({
setDescription(component?.description ?? ""); setDescription(component?.description ?? "");
}, [component, open, internalOpen]); }, [component, open, internalOpen]);
const handleShareComponent = () => { const handleShareComponent = async () => {
//remove file names from flows before sharing //remove file names from flows before sharing
removeFileNameFromComponents(component); removeFileNameFromComponents(component);
const flow: FlowType = checked const flow: FlowType = checked
@ -113,7 +113,7 @@ export default function ShareModal({
is_component: is_component, is_component: is_component,
}); });
saveFlow(flows.find((flow) => flow.id === tabId)!, true); await saveFlow(flows.find((flow) => flow.id === tabId)!, true);
saveFlowStore(flow!, getTagsIds(selectedTags, tags), sharePublic).then( saveFlowStore(flow!, getTagsIds(selectedTags, tags), sharePublic).then(
() => { () => {