Update child views without removing their elements#14459
Merged
Conversation
Contributor
Author
|
I'd also love to see this in 3.7.3 but will leave that up to @mattpap |
Contributor
Author
|
Thanks @mattpap, would appreciate review. Alternatives here might be:
|
philippjfr
commented
Apr 17, 2025
philippjfr
commented
Apr 17, 2025
philippjfr
commented
Apr 17, 2025
Contributor
Author
|
So I have determined that both of us were completely overthinking this. The removal of nodes was completely unnecessary because simply appending the children in order will move them to the correct place in the DOM (and actually be a complete no-op if they haven't moved at all). Unless you see some flaw in that thinking I think this is the nicest and simplest fix. |
mattpap
reviewed
Apr 17, 2025
philippjfr
commented
Apr 17, 2025
philippjfr
commented
Apr 17, 2025
Contributor
|
I added some rudimentary tests. |
mattpap
approved these changes
Apr 24, 2025
mattpap
added a commit
that referenced
this pull request
Apr 24, 2025
* Implement LayoutDOM.update_children without explicitly removing nodes * Fix lint * Fix logic * More lint * Simplify for loop * No tabs * Also update handling of element views * Remove empty line * Fix self_target children lookup * Fix type errors * Fix and simplify logic * Fix element views * Apply suggestions from code review * Simplify further * Fix lint * Revert to append (instead of appendChild) Rever * Compare DOM nodes non-structurally by identity * Add regression tests * Unify all rebuilding of child views --------- Co-authored-by: Mateusz Paprocki <mattpap@gmail.com>
mattpap
added a commit
that referenced
this pull request
May 8, 2025
* Update switcher.json * Fix Legend's glyph rendering for `dpr != 1` (#14443) * Fix Legend's glyph rendering for dpr != 1 * Allow to override screen scaling in testing * Add regression tests * Fix Legend's inactive visuals in CSS mode (#14454) * Fix Legend's inactive visuals in CSS mode * Add visual regression tests * Update child views without removing their elements (#14459) * Implement LayoutDOM.update_children without explicitly removing nodes * Fix lint * Fix logic * More lint * Simplify for loop * No tabs * Also update handling of element views * Remove empty line * Fix self_target children lookup * Fix type errors * Fix and simplify logic * Fix element views * Apply suggestions from code review * Simplify further * Fix lint * Revert to append (instead of appendChild) Rever * Compare DOM nodes non-structurally by identity * Add regression tests * Unify all rebuilding of child views --------- Co-authored-by: Mateusz Paprocki <mattpap@gmail.com> * update docs for DatetimeTickFormatter (#14452) * Updated formatters.py --------- Co-authored-by: Chinmay <chinmay.cc.06@gmail.com> * fix links to code pen (#14471) * add jquery to fix links to code pen * remove jquery dependency * remove patched show function * use Node.COMMENT_NODE instead of number * avoid line breaks in templates and code pen * fix missing title * Fix positioning of DOM rendered Legend annotations (#14457) * Fix positioning of DOM rendered Legend annotations * Treat inner canvas panels equally to outer * Robustify resize of canvas after layout * Update visual baselines * Make sticky toolbar work correctly * Refactor PlotView._update_layout() * Invalidate layout if renderers change * Add more regression tests * Update visual baselines * Always repaint Legend's glyphs after rendering * Update visual baselines * Implement move semantics in Plot.add_layout() * Tighten regressions' baseline viewports * Fix types of splattable figure's attributes (#14401) * Fix types of splattable figure's attributes * Add rudimentary typing tests * Python 3.10 compatibility * Improve corner case handling in datetime formatter (#14473) * Add release notes --------- Co-authored-by: Philipp Rudiger <prudiger@anaconda.com> Co-authored-by: Moritz Schreiber <68053396+mosc9575@users.noreply.github.com> Co-authored-by: Chinmay <chinmay.cc.06@gmail.com>
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR reimplements
LayoutDOM.update_childrenandPaneView._update_elementsto avoid the removal of DOM nodes before they are re-added.