-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix renderDelay not being applied to dynamicBlocks #3595
Conversation
38e9b88
to
16fc4f5
Compare
Codecov Report
@@ Coverage Diff @@
## main #3595 +/- ##
==========================================
- Coverage 63.06% 62.91% -0.16%
==========================================
Files 871 866 -5
Lines 30189 30188 -1
Branches 7269 7269
==========================================
- Hits 19039 18992 -47
- Misses 10965 11007 +42
- Partials 185 189 +4
... and 49 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
the approach to only redraw if "!filled" did not respond to some state tree changes (but surprisingly passed all tests). for example, changing 'Show translation' on sequence track did not update the rendering so, reverted that change and more basically added a setTimeout(...,renderDelay) before registering the render reaction inside of serverSideRenderedBlock |
@@ -659,7 +658,7 @@ export function makeAbortableReaction<T, U, V>( | |||
return undefined | |||
} | |||
}, | |||
async (data, mobxReactionHandle) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unless the mobxReactionHandle is very useful to pass to the renderReaction, seems like we can remove it. avoids the typescript error
9878e72
to
18c2185
Compare
18c2185
to
f6eda27
Compare
this PR now includes a 'new approach to the block hydration' I saw a persistent error that said this "Node.removeChild: The node to be removed is not a child of this node", it was rare but if i scrolled really fast for awhile it could be reproduced. this was quite odd, and I could not find much info online for it. Also, if I removed the requestIdleCallback ( I made a stackoverflow question to see if there was any hivemind knowledge about this https://stackoverflow.com/questions/75786709/how-can-you-properly-use-hydrate-and-or-hydrateroot-inside-of-an-existing-reac, but then possibly I made an alternative solution that may work instead: using dangerouslySetInnerHTML instead of changing domNode.innerHTML, and then NOT using unmountComponentAtNode at all. the thinking is the node is fully owned by the react tree and does not need it. if I add unmountComponentAtNode back as e.g. the destructor of the useEffect, then I get errors like ('Warning: unmountComponentAtNode(): The node you're attempting to unmount was rendered by another copy of React.'). as far as i can tell, i did not see any memory issues from removing unmountComponentAtNode (e.g. did not affect #3596) |
f6eda27
to
d4c1065
Compare
d4c1065
to
14ecf0b
Compare
made this PR only related to block renderDelay and the hydration changes now |
a3b06df
to
822162b
Compare
822162b
to
fa3e69f
Compare
a potential fix for the hydration error was added. i only unmountComponentAtNode after setTimeout(0) which in my testing did not create any more warnings about things like "Warning: unmountComponentAtNode(): The node you're attempting to unmount was rendered by another copy of React."...answered my own stackoverflow here https://stackoverflow.com/questions/75786709/how-can-you-properly-use-hydrate-and-or-hydrateroot-inside-of-an-existing-reac |
ultimately, the hydration changes and other refactorings produce intermittent hydration errors and react errors. it's hard to understand. I don't believe our current setup is the most idiomatic, but I have not seen these errors with our current system. therefore, leaving current system untouched. can close this for now and revisit in future perhaps |
Currently, dynamicBlocks rapidly re-render themselves on scroll which can cause some issues if the rendering is an expensive routine
the blocks currently render themselves automatically 'afterAttach' inside the serverSideRenderedBlock code. this PR changes it so that the BaseLinearDisplayModel will render them after an autorun delay (set to
renderDelay
), so the rendering is then controlled not by the block's automatic afterAttach behavior, but by the display model itself.Blocks are not re-rendered if they are already "filled"
Fixes #887
part of a possible effort to do the 'variant matrix display'