Modify page before it gets rendered

Hello all

I would like to modify a page/component before it get rendered. E.g. when the page/component is evaluated on the server I make
a database lookup and depending on the result I would like to modify the page/component and render that new page.

E.g. if the database query is empty I would like to show a “Register something component” and if the query is non empty it should
display some grid.

Best regards,
Dieter

So would it make sense to put that logic in the constructor?

If the page is refreshed is a new page object be created?
Because the change to the database could have happened,
and on refresh the other component should be displayed.

Refreshed how, browser page reload? If that, then yes, the objects will be recreated. If it’s an in-app navigation event, you should take care of it in a suitable navigation event.

-Olli