When to populate on page load vs group data source?

I have a category group (Group Category) and want to load a specific category when I pass its ID to the page. I’m considering two approaches:

  1. Load the Group Category datasource and perform a search for the category with the provided ID.
  2. Display data in a group on page load and then perform a search for the category with the provided ID.

It’s worth noting this page is kind of a single page app, with dozens of groups for different objects, so setting the page “Thing” to category is not the way.

I have a few questions regarding these approaches:

  1. When I load the category from the group itself, does the data source update in real-time? That is, will the page update when data is updated by another user or the same user in a different tab or process?
  2. When I load data on page load, does it load once and then remain unchanged? If so, will updates to the data elsewhere not be reflected?
  3. Finally, I need to set a custom state when a page loads for the first time with data from the database. Is this only possible on a page load event?

Thank you for your help.

When you pass a category ID to a page, you can just set the page’s data type to be Category, Bubble will auto populate the category in Current Page’s Category.

Thanks @net-tt I added this as you were typing your answer.

Yes

Depends on where and how you are ‘loading’ the data. ‘load’ it to a custom state, no, the custom state remains as is. Use a repeating group and put ‘load’ the data via the datasource, yes, it is live updated unless you use operators to make it static.

You can set a state from any kind of event you want, so a button click, or any other event trigger will work to trigger an action to set the state of an element.

If you are a hidden group instead of a custom state, the data will be automatically loaded on load page without manually doing so.