0👍
The only logical reason i can think of – You are changing the loading variable to true, before the data is actually processed and passed into the array, if you are using a forEach loop consider using await or a simple for loop.
Source:stackexchange.com