You won't be even able to fit them in the viewport of the user. You're fetching 25 bookings. In some cases, these 25 bookings are nested objects because in GraphQL you have a flexibility to query field inside field inside field, right? So there can be many nested fields. Yeah, that could affect the performance of your application. And like I said, you know, if you see it on URL like you would be able to understand. Yeah, you'd be able to understand that this particular nested query is also affecting the performance.
I muted myself and now I un-muted myself. Welcome to the digital world. It's like, it's like, this is a new thing, meeting remotely. So performance is of course, well, one of the most important topics to making a good web app. Of course, there's a lot of things that make a good web app. And, well, pagination is one thing you can do, but is there any other thing you can think of that can help, of course, with GraphQL to improve performance?
Yeah, actually, you know, like using, differing some particular fields that you don't need on the viewport of the user, I saw a talk by Uri that different stream directives are quite powerful and being supported by GraphQL Yuga. So with these fields, we don't really fetch, you know, what it was not required on the user interface, on the first load by the user. So that's quite a good performance booster that you can give to your application. But more than that, in our application, what we have seen is just fetch, you know, fetch lesser fields. On the front end side, we think that let's fetch five to six more fields and you would be done with the task that you are given at hand, right? But we don't understand that these five to six fields are going to all your downstream services. That's when you realize, that's when you understand that the cost of this query is hitting two, three database queries, hitting two, three downstream services. That's when you realize that it is going to take more time. Yeah. Yeah. It's, sometimes, if I understand correctly, you add two or three more fields to your query and you think it's just two or three more fields, but that can actually be a really heavy query. So basically, the advice would be to always just keep monitoring. When you're editing a query, keep monitoring, keep an eye on what's happening, test before, test after, and make sure you're not slowing down your application significantly. Yes, yes, absolutely. All right, awesome. So, okay. That's good stuff. And going back a little bit to the UI end. So we are saying just fetch what's in the viewport, but are you also using something like skeleton screens in the UI? Yes, yes. So like, till you're fetching your data, you can take advantage of, like we are using suspense, okay? Suspense in React, where you can show the skeleton of your UI till you get the data, you get an improved perceived performance on the UI side.
Comments