Question re: WeWeb auto fetching Collections / performance, etc

When you create collections that are set to “auto” and “preserve on navigation” - I am curious when the requests for data are first called and if they are fetched in parallel?

If I have a LOT of collections that need to be loaded ONE TIME on user login - BEFORE the user starts their session - and those collections are then updated as needed by realtime sockets.

So … I would love a little more context from WeWeb (or anyone in the “know”) of when these collections are fetched and if they are fetched in parallel, etc.

I am just wondering if I refactor all my collections into just manual requests > variables - and load these in parallel in javascript workflows in batches of 6 requests (modern browsers support 6 streams) if it would be more performant that using collections with “auto” and “preserve on navigation”??

If I am going to obsess on performance and pre-fetching tricks etc - seems like might make more sense to refactor away from collections entirely? Or am I crazy??

I would appreciate any comments from anyone on WeWeb team.

Thoughts @Broberto @dorilama ??

I think I could also continue use collections, turn OFF the “auto” and then just fetch when I want and in parallel …

2 Likes

following this topic!

Ideally you wanna have 1-2 endpoints fetch most of the data. More than 6 sounds almost bad. The Fetch collections automatically fetches the collections at page load, only when they’re used anywhere in the page. If you want performance and reduced latency, edit data on the frontend once fetched, don’t re-fetch the whole collection because you changed one row. React to that one row’s change on the front-end.

There is much to be said, but it’s hard to cover this properly without seeing your “mistakes” individually. If you need to go over your specific cases, it’s best done on a session.

1 Like

I’ll try to get more specific - let’s say all collections (regardless of the number of collections) are used on the “home” page where user is directed at login - and “preserve on pagination” is selected.

  1. At login - those collections would be “automatically loaded”. Are they loaded in parallel by WeWeb - or loaded sequentially ?

  2. I am under the impression that if “preserve on pagination” is selected - and user navigates to PAGE 2 which ALSO uses (for example sake) all of the same collections - that they would NOT be automatically re-loaded - is this correct?

are you actually going to use all the collections on the first page load? you can test on an empty page loading collections automatically or manually in parallel with js and see from the network tab of the dev tools if there is any meaningful difference. Anyway they will be loaded after the weweb app loads and processes all the things that need to be done, so there will always be a lag. The only way to speed up the process is to load less data, only what you 100% need. If you need a lot of data before initial user interaction and a good part of the data will stay the same you can have better performance on subsequent reloads saving the data in the browser. This is easier done when you have a framework that automatically gets the data in the background and sync it with the browser storage.

1 Like