Display vs Visible in Perspective

Hi, on views, does Display actually “shut down” the component from running if it is off? vs… Visible (still running, but not shown)?

thank you

The short answer is no, neither really prevents the component from ‘running’. It’s still present in the DOM in both cases (just with a different CSS attribute preventing it from rendering) and it’s still present in the gateway’s model of the frontend session.

1 Like

Is that the only difference then?

Basically, yes. display is an available attribute in flex based containers, because just making them invisible doesn’t actually skip them in the layout calculation - so a component in a flex container with visible: false will be a gap, but display: false will actually be skipped entirely in the layout.

3 Likes

Ahhh. Thanks for the clarification. :+1:

Is such a thing possible? Disable an entire component in one fell swoop?

I bind stuff to props.position.display and return a bool(0) or bool(1) all the time. Works well.

Thanks wking, I’m doing similar, but what I mean, is there something beside Display or Visibility that could just “shut down” a component so that it’s not sitting there erroring or calculating or anything if I wanted to disable it.

Oh my bad. I don’t think so. I do try and use try except blocks for sketchy bindings. If they have a script transform.

Maybe there is a method to disable a binding? like there is to refresh?

self .refreshBinding( "props.data" )

If you have a component which you might not want executing scripts or calculations, what I would recommend is placing that component in a View of its own, then using an Embedded View to render that View. When you want to turn the component “off”, then change the path of the Embedded View to something else and set the Embedded View to not display.

Using this setup would actually remove the component from the DOM.

3 Likes

Brilliant! Thank you.

1 Like