-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Provide visibility-based rendering as part of the View API #7235
Comments
@akhenry I've got a draft PR, but also have a question: should the PreviewContainer bother with visibility? I feel like in that case we should just fire Otherwise, implementation was pretty straightforward! Update: discussed above with @shefalijoshi and PreviewContainer is not bothering with visibility. |
To test:
|
Verified Testathon 12/4/23 CPU usage drops when swapping tabs to the non-plot and non-LAD pages |
Fix verified on 12/04/2023. CPU drop was observed when switching to a notebook from a high frequency plot or lad table tab. |
Is your feature request related to a problem? Please describe.
Throughout our code we make use of RequestAnimationFrame to ensure we are not trying to update the view any quicker than the browser can handle. Modern browsers will defer or throttle rendering of inactive tabs, however this does not apply to tabbed views within an Open MCT display, because of course the browser has no concept of Open MCT tabs.
To bring the benefits of optimized tab rendering to Open MCT tabbed displays we have implemented a class that defers rendering for elements that are not visible for any reason (including being scrolled out of view).
This visibilty-based rendering should be available via our View API so that third-party developers can make use of it as well.
Describe the solution you'd like
The Open MCT framework has a handle to a view's parent element and could use that to automatically observe for visibility. Open MCT could then pass an optional
renderIfVisible
function to theshow
function of views that would act likerequestAnimationFrame
except based on the visibility of the view's parent element. We'll also need to doopenmct/src/ui/preview/PreviewContainer.vue
Line 150 in 7f8262b
Because Open MCT also knows when a view is destroyed, this would allow Open MCT to manage the entire lifecycle of the visibility observer and obviate any risk of memory leaks.
The text was updated successfully, but these errors were encountered: