Esri / solutions-components

A collection of UI components for constructing webapps.
Apache License 2.0
11 stars 5 forks source link

Avoid page refresh/dealy when liked or disliked #661

Closed skrishn closed 3 months ago

skrishn commented 4 months ago

There is a delay/page refresh once like or dislike is clicked. We want to avoid it to improve the experience.

2024-05-29_18-14-47

sumitzarkar commented 4 months ago

@skrishn

These operations are async requests and we need to wait till all these actions are completed hence we have added the loading indicator.

chris-fox commented 4 months ago

@sumitzarkar, I understand why it is happening, can we just assume the that when liking or disliking it is a pretty simple operation and 99.9% of the time it will be successfully and just increment the count synchronously, so there is no page reload/refresh. If it fails after the async request we could do a refresh of the UI to set the state due to the error?

sumitzarkar commented 4 months ago

@chris-fox

The only issue with this is if in the popup details the like/dislike field is shown then to reflect the new updated values we have to refresh the entire details. If we are not concerned about the updation of the like/dislike field values in feature details we can avoid the loading indicator and do other tasks in the background like you mentioned

chris-fox commented 4 months ago

yea, let's do that. I don't have a use case for wanting the like/dislike fields in the feature details. We can wait to see if we get customer requests for refreshing the details after a like/dislike.

sumitzarkar commented 4 months ago

@chris-fox

We have one more way to show progress indicator as we are using calcite-buttons, this will avoid user clicking same button multiple time when the operation is in progress reporter661

chris-fox commented 4 months ago

@sumitzarkar, that looks good.

chris-fox commented 4 months ago

I am seeing the new loading icon next to the like/dislike buttons but I still see the entire feature details panel reload after the like/dislike action completes.

skrishn commented 4 months ago

Yes, I see the same. @sumitzarkar can we fix this feature panel loading?

sumitzarkar commented 3 months ago

@chris-fox @skrishn

I am seeing the new loading icon next to the like/dislike buttons but I still see the entire feature details panel reload after the like/dislike action completes.

We have fixed this and will deliver it in the next code drop

skrishn commented 3 months ago

@sumitzarkar I see the numbers jumping after hitting like/dislike

https://localgovdev.mapsdevext.arcgis.com/apps/instant/reporter/index.html?appid=54fe3738157d4775b8ff9794c34f58ff

screen-recorder-tue-jun-11-2024-15-12-57.webm

sumitzarkar commented 3 months ago

@skrishn

I see the numbers jumping after hitting like/dislike

We don't have control over this. We see this behavior as we are showing the button's loading indicator and updating the button's lable

skrishn commented 3 months ago

@sumitzarkar I'm still seeing this on QA too. As I mentioned in the call, I see this behavior after the recent code drop. Please look to see if there is a way to avoid the number sliding to the left as the loading indicator updates the value.

chris-fox commented 3 months ago

@skrishn, this is the default behavior of the calcite button when you set the loading property to true. This was to prevent the user from rapidly clicking the like or dislike button before we could apply the edits to the feature service.

https://developers.arcgis.com/calcite-design-system/components/button/

I guess an alternative would be to disable the buttons until the edit is applied. In this way they wouldn't show the loading icon, but would grey out until the edit was complete. This might be a weird user experience though.

sumitzarkar commented 3 months ago

@skrishn @chris-fox

Please confirm if any changes requried in this

skrishn commented 3 months ago

@sumitzarkar No action is required at this point. We can consider the alternative from Chris based on user feedback.