That stack would make it even more unique than func.toString + deps as JSON. I wonder if it’s necessary though? What’s the worse that can happen if the func.toString + deps is the same as another somewhere - it should produce the exact same output. Maybe cleanup gets tricky though.
I was thinking about this a bit more - if I keep a global instance manager, I have to make an assumption about some React behaviors, that I don’t know for sure. I have to assume that when a render is run in concurrent mode, however many times that at least 1 will be committed, so that I can rely on the cleanup of useEffect in that one instance. But I don’t know that for sure - are there cases in react where it might through away all the renders, and never commit?
Maybe it’s best to reserve this method only for cases where there is a Provider and Suspense. Then I can be sure of the lifecycle. I’m going to start with an implementation along these lines.