Fixes UI infinite polling after image delete #4389
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this change?
After an image is deleted, Kahuna with poll endlessly looking for the deleted image to be removed from the API.
As soft deleted images do not disappear from the API, there is not way for this loop to end other than when the page is next reloaded.
Stopped the infinite polling by updating the polling function to recognise soft deleted as deleted.
Also returns the polling promise rather than void from
pollDeleted
.The existing code appears to have been dropping straight instantly, without waiting for the poll to complete.
Delete from list view UI now behaves as expected; there is a noticeable pause then the image is removed from the view.
Delete from single image screen may be slightly better.
This delete triggers a search refresh to remove the deleted image and is probably catching stale Elastic eventually consistent search results most of the time. The deleted image will still be visible in the search results most of the time as per what currently happens.
I think this PR is a net improvement.
How should a reviewer test this change?
How can success be measured?
Who should look at this?
Tested? Documented?