Error when creating a loader for UI Builder

I have a long piece of logic interacting with the backend that takes 15 seconds to complete.

So I am trying to create the effect of loading, using the Spinner element. I have it in a block that is initially not displayed, and I try to display it when the long logic starts running, and hide it when the results are ready.

But I get an error that display is not defined.
image

I have tried using a Page Data field instead but I still get the same. Any other direction I should be going towards?

Hello @Andreas_Marinopoulos

If I clearly understand this phrase.

I have it in a block that is initially not displayed

The problem goes from here.

If the parent block is not rendered(displayed), all child blocks also will not be rendered. In this case, you will not be able to set any property, and you will see a problem like you share - Can not set properties of undefined

How solve this issue? You should manage visibility for the parent block, not for the spinner.

In all other situations, you should remember and follow the rule - you have acces only to rendered items.