cylc-ui icon indicating copy to clipboard operation
cylc-ui copied to clipboard

lumino: suspend views that are not displayed

Open oliver-sanders opened this issue 8 months ago • 2 comments

Cylc views continue to update, even if they are backgrounded (i.e. obscured by another tab). This is inefficient, but hopefully avoidable.

We are already using the lumino:showevent to determine when a tab is foregrounded:

https://github.com/cylc/cylc-ui/blob/f70d4227d06d876430ca56c2130bf49584da39ea/src/components/cylc/workspace/Widget.vue#L50

What can we do to suspend Vue's event loop for these components?

Would this even be enough? E.G, the graph view makes use of the JS global event look via setTimeout.

oliver-sanders avatar Jun 27 '25 15:06 oliver-sanders

We could detect a widget hide event: https://lumino.readthedocs.io/en/latest/api/variables/widgets.Widget.Msg.AfterHide.html

There is an example of doing the opposite (detecting the show event) here: https://github.com/cylc/cylc-ui/blob/ea7bbbcbc674109f102d1424076fa064a8843f86/src/components/cylc/workspace/luminoWidget.js#L85-L86

MetRonnie avatar Jun 30 '25 10:06 MetRonnie

Perhaps we should auto-provision a computed property for the show/hide status of a tab and let the views themselves handle this.

I'm not sure there's a clean way to suspend a Vue component tree with timers and more.

Note, raising this in relation to a bug #1282 which is caused by the view updating whilst hidden (probs resulting in some kind of offset in element bbox calculations). However, this should have broader efficiency advantages too.

oliver-sanders avatar Jun 30 '25 10:06 oliver-sanders