#54 3 tips to speed up your app for Microsoft 365
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!
Optimizing your app’s performance is an art. If you build apps for Microsoft 365 and use the Microsoft Graph JavaScript SDK, I wrote a few articles recently that you’ll find helpful:
- Cache data when using the Microsoft Graph JavaScript SDK - build a custom middleware for the Microsoft Graph JS SDK to extend it with caching
- Should you always optimize your Microsoft Graph queries? - sometimes by loading more content, you can speed up your app. Here is why
- Avoid duplicate requests with the Microsoft Graph JavaScript SDK - duplicate requests slow down your app and often lead to throttling. Here’s how to avoid them
- Avoid expired cache with the Microsoft Graph JavaScript SDK - by refreshing cache in the background you can keep it fresh and offer your users an awesome user experience
Happy reading and leave a comment below if you have any questions!