Did you know that you can make your app faster by loading more data? How's that for counterintuitive advice? But hear me out: say you're building an app that shows a user's name and job title in one place and then you need their ID to load some more data. Seeing these two parts of your app separately, you'd optimize each request to just download the data it needs. You'd issue two requests. But by extending the request to include the user's name, title, and id, you'd bring it to a single call. This is an improvement right there.
By combining calls you can decrease the number of API requests and speed up your app. But since each part of your app is still independent, you need to ensure that you won't issue the same requests multiple times. If you do, you might get throttled and that's a poor user experience. Luckily, there are ways to avoid it with just a few lines of code.
Once you have the data, you'd best cache them for as long as possible. When it expires though, users will still need to wait for your app to load fresh data, right? Yes, unless you refresh your data in the background without blocking users!
- Should you always optimize your Microsoft Graph queries? - sometimes by loading more content, you can speed up your app. Here is why
Happy reading and leave a comment below if you have any questions!