You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes we need to execute a specific function when the editor is mounted and also get the status of a hook.
I'm trying to get a hook state from onMount but it only gets the value when is mounted. (it does not update)
It would be very useful for things like addCommand when the right place to initialized it is in onMount
For example:
If I want to save a file I would use the function addCommand like this:
use useEffect with a correct dependency array and attach/dispose addCommand every time dependencies are changed - to be able to get the new/updated values
use useRef for all values you use inside a hook - again, to be able to get the new/updated values
I ended up using useEffect another problem I encounter was that addCommand does not return a disposeanymore. Using addCommand in useEffect without disposing it made my app very slow in a couple of minutes due memory leak. I ended up using addAction instead which returns a dispose
I'll close this issue but for any one out there. Don't use addCommand because you won't be able to dispose it. Use addAction instead
Sometimes we need to execute a specific function when the editor is mounted and also get the status of a hook.
I'm trying to get a hook state from
onMount
but it only gets the value when is mounted. (it does not update)It would be very useful for things like
addCommand
when the right place to initialized it is inonMount
For example:
If I want to save a file I would use the function
addCommand
like this:Is this not the right way to do this?
The text was updated successfully, but these errors were encountered: