Update getCurrentOutputInfo() on element resize or visibility change #3682
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.
Currently shiny.js only sends input values tied to output values (e.g.,
.clientdata_output_{id}_width
, etc) to the server (i.e.,getCurrentOutputInfo()
) when the window resizes (or if certain Bootstrap events happens). This PR leveragesResizeObserver()
andIntersectionObserver()
to update those relevant input values whenever the element is resized or has its visibility changed (regardless of what has caused that change)TODO
Investigate more why fbe9d24 is needed(it's needed because, if the output container is stretchy, the image won't know to shrink when the container shrinks since it's size is determined by the parent)