-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Description
Describe the problem that you experienced
Steps to reproduce:
Complete the tutorial chapter about asynchronous resources (see the URL of the topic with the problem) and test the compiled app by clicking on Load Invalid User and then Reload.
Expected result:
Loading user... paragraph is displayed again a little while before it says Error: User not found back.
Actual result:
The element is cleared instead of displaying the Loading user... paragraph again before showing back Error: User not found.
How did I fix it up?
The tutorial actually not tells us about the reloading value that can be returned by the userResource when it is reloading (reload() function called). So I edited the isLoading computed signal like this:
isLoading = computed(() => ['loading', 'reloading'].includes(this.userResource.status()));
and everything were working fine after this update.
So what about updating the isLoading function from the tutorial to make it work as it is intended to work?
Enter the URL of the topic with the problem
https://angular.dev/tutorials/signals/4-managing-async-data-with-signals