diff --git a/ivette/src/renderer/ASTview.tsx b/ivette/src/renderer/ASTview.tsx index 574b069b906d8d7b878a93d8504c173ce23a5157..ee500708713b0ffc33b6302cf93f41933bff9b32 100644 --- a/ivette/src/renderer/ASTview.tsx +++ b/ivette/src/renderer/ASTview.tsx @@ -130,10 +130,9 @@ const ASTview = () => { const propertyStatus = States.useSyncArray(Properties.status).getArray(); const statusDict = States.useTags(Properties.propStatusTags); - const [edited, setEdited] = React.useState(false); - React.useEffect(() => { - if (edited && theFunction) { + const setBullets = React.useCallback(() => { + if (theFunction) { propertyStatus.forEach((prop) => { if (prop.function === theFunction) { const status = statusDict.get(prop.status); @@ -150,11 +149,12 @@ const ASTview = () => { } }); } - }, [buffer, edited, theFunction, propertyStatus, statusDict]); + }, [buffer, theFunction, propertyStatus, statusDict]); React.useEffect(() => { - buffer.on('edited', () => { setEdited(false); setEdited(true); }); - }, [buffer]); + buffer.on('change', setBullets); + return () => { buffer.off('change', setBullets); }; + }, [buffer, setBullets]); // Hook: async loading React.useEffect(() => {