Same Server Connect in Layout and Content Page Running Twice

Hello!
Hope you all are well. Just quickly I’m still new overall.

I am trying to understand how I would reuse the state/data between my layout/page and page/partials from server connect/database query.

Im testing with data ill need on nearly every page/partial (example different currencies, order statuses and so on from postgreSql database). What i want is to not make calls every load (use cache) but when i do need to make a query, only send one query not multiple for same data.

So on layout page, I did a server connect to get this database query, and then I am caching it in local storage (1hour). then I can access that information in layout page easily (via the server connect schema).

However I get confused when I want to access same information in a content page/partial.
I assumed I needed to create another local storage on the content page (same id as the other one on layout page, so they should access same data), but I cant reference the data directly from the local storage as I don’t know the schema. So I created exactly same server connect action on that partial page, so I can access it in server connect available data.

Now this generally works, example the data is cached, for future page loads. However the initial page load, its making two calls for same data (which makes sense) but this will cause shitty first page speeds when i have a lot more calls to make. I assume my overall management of data is wrong, but I’m not too sure how to do it, nor cant find too much information on this.

Two calls:

The main method that is coming to mind is manually settings up a schema on the local storage on each page for that data that will be cached in local storage. Is there a simpler way to managing schema across pages/partials?

Would appreciate anyones help. Data management is my biggest area where i need to improve in wappler. In bubble.io it wasn’t ideal, very restrictive but it always presented you with what data should be available, is there a overall workflow process that i should be following in wappler to achieve something similar.

Community Page
Last updated: