-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Maps] Fixed double click issue when deleting a shape #124661
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for opening this. Small user feedback like this PR introduces makes such a big difference in application polish.
What do you think about disabling the draw buttons on the left when edit mode is WAIT
? Users can exit WAIT
state by clicking on these buttons.
A good way to see this is to open your browsers debugging tools and go to the network tab. In chrome, there is a "no throttling" select. I find that changing this to "slow 3g" gives you time to really see the interaction with a slow network and mess around with controls when in "wait" state.
Pinging @elastic/kibana-gis (Team:Geo) |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove waitingState from DrawFeatureControl. Since actions addNewFeatureToIndex
and deleteFeatureFromIndex
modify the edit mode at the end of the action, I think it makes the most sense to also modify the edit mode in the action at the beginning of the action so that all edit mode changes are in the same location in the code base
...k/plugins/maps/public/connected_components/mb_map/draw_control/draw_feature_control/index.ts
Outdated
Show resolved
Hide resolved
...ublic/connected_components/mb_map/draw_control/draw_feature_control/draw_feature_control.tsx
Outdated
Show resolved
Hide resolved
@elasticmachine merge upstream |
...ublic/connected_components/mb_map/draw_control/draw_feature_control/draw_feature_control.tsx
Show resolved
Hide resolved
x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_control.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_control.tsx
Show resolved
Hide resolved
@elasticmachine merge upstream |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking much better, I like how this PR is cleaning how editShape is set. It's much easier to follow now that it is set in an action vs having it set via a callback triggered by mb_draw.
I am still able to trigger the original bug 1 out of 20 tries, so its rare but still possible. Adding a debounce to DrawControl.onClick with a small timeout of something like 100 will eliminate the possibility of double clicking a single feature before redux has time to update.
@nreese I'm not quite sure that adding a debounce to DrawControl.onClick will solve the original issue. |
@elasticmachine merge upstream |
You are right, the debounce solves one race condition where a second feature click is allowed before redux updates state to WAIT but there is another race condition where a deleted feature can be clicked after state is set to DELETE but before the layer has re-synced with MapLibre and re-rendered.
A timeout of arbitrary length does not completely fix the race-condition, it just makes it more unlikely. Chatted with @thomasneirynck offline about a solution to avoid the second race condition and we came up with the following
|
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
code review, tested in chrome
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
* elastic#117369 - Fixed double click issue when deleting a shape * elastic#117369 - updated deleting shape method; redux changes; * elastic#117369 - waiting state for adding shapes feature * #1173669 - refactoring; removed unused functions * 117369 - refactoring * 117369 - Updates for onDraw methods, now the selected shape is not reset * 117369 - made addNewFeatureToIndex to be called once * 117369 - refactoring * 117369 - refactoring and clean up * 117369 - removed then method from actions * 117369 - refactoring * 1177369 - refactoring * 117369 - refactoring; Added new state in redux * 117369 - refactoring * 117369 - renaming layerId to featureId Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* elastic#117369 - Fixed double click issue when deleting a shape * elastic#117369 - updated deleting shape method; redux changes; * elastic#117369 - waiting state for adding shapes feature * #1173669 - refactoring; removed unused functions * 117369 - refactoring * 117369 - Updates for onDraw methods, now the selected shape is not reset * 117369 - made addNewFeatureToIndex to be called once * 117369 - refactoring * 117369 - refactoring and clean up * 117369 - removed then method from actions * 117369 - refactoring * 1177369 - refactoring * 117369 - refactoring; Added new state in redux * 117369 - refactoring * 117369 - renaming layerId to featureId Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Closes: #117369
The user will now see a waiting icon after deleting the shape, but multiple clicks will not be processed until the async operation is complete.
cc @nreese