Sometimes you want to use a gliderecord query from within a client script. In that case make sure you use a callback function. For this example I created 2 client scripts; CS1 was synchronous and CS2 asynchronous. Looking at the timing diagram below we can see the difference.

CS1 needs 107 ms to retrieve the data from the server and then needs around 150 ms to process the result. During all this time the browser cannot do anything else. CS2 needs 108 ms, but is not blocking the next query.

Conclusion: in this case we saved the user around 250 ms waiting time, with just a small change in the script.

Figure 1 – CS1: Synchronous query

Figure 2 – CS2: Asynchronous query