Do you have any code to share? I don’t know if you mean fast refresh recompile or prop changes forcing a re-render. React.memo may be what you are after:
React Top-Level API – React (reactjs.org)
Have a look at this as well - I saw your cool demo with lots of open windows. If you are re-parenting the canvas it will force unmount otherwise - I have not used this component myself, but it seems like it may address the problem you describe:
httptoolkit/react-reverse-portal: Build an element once, move it anywhere (github.com)