Problem with more than one logical argument on an if function on an API call


I’m having a problem which feels like it might be a bug, but of course it could also be a mistake I’ve made!

I have created an API service to return specific values for the logged in user from a table in the database:

There is a page where I then want to use the values of the properties returned by the API call to drive conditional logic, so I load them to page data using the on enter functionality:

I then want to use the properties to drive logic on a form on the page. So I’ve set up logic for before mount of the form:

This works fine and this is the result, with the titleText changed to reflect that step1Complete is true in the getUserStage property in page data.


But when I add a second logic condition, such as changing the visibility of the other text, like this:

I get a completely blank screen when testing.

I can’t think of any reason why this would happen, the logic I’m using has been proved to work because it sets the titleText when I only use one piece of logic after the if statement.

Any help much appreciated.

Another test occurred to me, and I found that it wasn’t the multiple arguments that was the problem as I could change multiple text fields on the form.

Instead it seems that I’ve misunderstood the difference between onbeforemount and onmount - having moved the logic to onmount I can now change visibility of elements and use other logic.


Your solution is exactly right - the onbeforeonmount event occurs before any DOM elements are constructed on the page, hence when you try accessing one in the logic, there is no element to change the visibility of.