Only call collections on certain pages

I have multiple collections that are utilized throughout the site.

One of the collections is only used when a user is logged in. The other one is for the general public.

How do I ensure that the collection that is used when a user is logged in is not even called from WeWeb.

In the backend, I ensure that the user is logged in before sending data back to the frontend, but I don’t even see a need to make the call and waste the resources when it will not be needed at all.

Hey @kevinwasie :wave:

I think all collections are fetched on page load.

One thing would be to filter them so that they don’t return any data on some pages, but they’ll still be fetched anyway.

Maybe something you can add to the requested features here: feedback.weweb.io

@Quintin Yes, that definitely seems like a needed feature. Practically, there is just no need to load all of those collections when they are not being used. In my case, there are 10+ collections loading with 100’s of records that don’t need to be loaded.

Second, for security, there is no need to expose authorized endpoints the the client side unnecessarily.

@kevinwasie wrong Quintin :sweat_smile: I’m not sure whether this was mentioned, but I had the same query a few months ago. How it works is, in the editor in order to make all the elements bindable to any collection you have. all collections are always loaded. This is not the case in the published version. So your development would be really resource intensive on your backend, but once you don’t work on it as regularly you should see those numbers go down :smile: I hope this helps you

1 Like

Ahhh this makes sense. Thank you