My question is bit difficult to explain but still I tried my best to explain it in the below playground
In my LWC project I have 3 step process and I divided it into 3 lwc pages
- parent
- child
- grandchild
Now as shown in the above playground on a click of a button I change flags and display the pages accordingly, in real time I am saving and retrieving data from the page in all three steps and I also have spinners on each page so that when data is coming and going to apex a spinner will appear.
The above structure works as expected but when data iterated on the page increased and if I click go to child button then it take 3 to 4 seconds of time to display the child page and coming back to parent takes even more time even though I am checking flags to show spinner(didn't add spinner on playground) but spinner comes only when a page is loaded and waiting from apex to retrieve the data from the database.
Even if buttons take time to respond at least a spinner should appear but the same is not happening.
Now my request is to please confirm if the above structure to show a three steps process is as per best practice or is there any better approach to display 3 LWC pages step wise step on click of a button as shown in the playground and if the button is taking 3 4 seconds of time to respond then how can I show the spinner on that period of time.
ADDED
In the next button If I write like below
nextPage = () => { this.showSpinner = true; this.step++; this.showSpinner = false; }
button takes 7 to 8 seconds to switch page but still no spinner comes
and if I change the button like below
nextPage = () => { this.showSpinner = true; this.step++; }
Still spinner comes after 7 to 8 seconds, could you please suggest how can I cover the waiting time with spinner?