Database queries when calling current user

I am working on creating a native app and I am making options for dark mode and light mode. I have a database field under User called “Dark Mode”. Each element is using styles with a condition set to “Current User Dark Mode is Yes”.
I am wondering if that means that for each element the app has to do a database query. If so, if I have (for example) 100 elements, would it have to query the database 100 times? Or is this setting cached in the app itself?
If so, what’s a better efficient method to save the dark mode setting? Would it a function in the app?

Also, what happens when the device doesn’t have internet connection? Is there a way to show a splash screen or something letting the user know that there is no connection?

Thanks in advance

1 Like

Hey Andy!
Regarding the number of times the database has to be queried, I’m not entirely sure but it’s very possible that bubble would go query the database separately each time. What I would do to make sure you’re not overloading your database is to have a popup element that has a group that pulls in the color theme based on dark mode/light mode. Then each element will reference this single group. Now you only query the db one time. Hooray!

There is 0 way to have your bubble app function without internet. There is a plugin Offline/Online Status Detect that will help you know when to put up that splash screen letting your user know there is no internet connection.

Hope this helps!


Many thanks. I’ll just add a state to be referenced to avoid the database queries


You can verify that yourself.
First open a blank tab, then open up f12 and go to the network tab. Go to fetch/XHR.
Now open your page and see how many queries there are, you can also inspect the content of each request, especially the response.

My guess is that bubble would coalesce all identical queries, and actually just send one.

Ah, it is a mobile app.
In that case, it’s gonna be a bit more difficult.
This article may help you.

Thanks. I think creating a state would probably serve me best