Schedule uncommitted reaction cleanup#120
Schedule uncommitted reaction cleanup#120RoystonS wants to merge 8 commits intomobxjs:masterfrom RoystonS:schedule-uncommitted-reaction-cleanup
Conversation
I've tweaked the test name to reflect what it's really checking for.
N.B. Depending on the implementation of a fix, this test might need some extra delays or act() calls to trigger a delayed cleanup before asserting that all is clean.
(I'll move this test into another PR.)
|
(Coverage drop is due to removal of last use of |
|
Wow, this is going to take some time to review for sure :) |
|
Yes, I think #119 could be merged separately, and there may well be value in doing that because, whilst it doesn't solve the leak, it does quieten down StrictMode by avoiding the unnecessary state mutations, making it more useable. I think the reaction cleanup will take a little longer to work through, and that doesn't need to hold up #119. If you do merge #119, I'll rebase this PR to tidy it up. I'm still unhappy about the edge cases, but am still trying to find a way to avoid a multi-render |
|
Can you please resolve conflicts to see the relevant changes only? |
This PR builds on PR #119 and introduces some fixes for #53:
Note that there's one aspect I'm unsure of, both of how to test or fix in a nice way, so I'm pushing this up for feedback. cc: @mweststrate, @FredyC
The happy day case, which I've tested for, and coded for:
But there's an edge case I'm concerned about (which is why I don't think that this PR is sufficient). What if it's been a while since the timer was kicked off, but the latest render phase hasn't had a corresponding commit phase yet?
I think, to do this properly, we need to record that a reaction is safe to clean up only once a commit phase has happened?