Fix map search bug causing duplicate requests properly #4040
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.
This fix merged in #4038 is wrong as well as the explanation to it. The duplicated request stems from the fact that the search editor
"location"
triggers the same commit callback as the "Search" button, which happens as soon as the search editor loses focus. All that change does is reducing the time between the execution of the callbacks from the search editor and the button (the callback from the button is now called immediately as the button is pressed and not when the mouse button is released), the search is still triggered twice. That only works purely by coincidence because the second search request is sent before the result of the first request is received, Effectively it is the same if you click the search button fast (as in press and release the mouse button quickly).The actual cause is - as already pointed out - the slightly delayed execution of the second search request after the result of the first request has already been received: A result containing at least one entry will select the an entry in the result list, which then updates the search editor. The then executed search request will use the updated text in the search editor and will then obviously return only the one entry with the exact match.
This fix causes the actual issue by removing the unnecessary commit callback for the search editor and instead fixing the incorrect setting of the default button, which is applied to the floater. However, the panel actually evaluating the default button in its
LLPanel::handleKeyHere
method islayout_panel_4
, which is the parent of all tracking-related controls. Removing the commit callback for the search editor and fixing the correct default button handling will now properly invoke the commit callback from the default search button without sending a duplicate request. This also fixes the unexpected behavior of actually triggering a search when the search editor loses focus.Also changed it so the pointer to the widgets is directly passed into the
LLPanel::setDefaultBtn
method as passing the name will cause agetChild
XUI lookup each time it is called - and it is called each time you enter anything in the search editor.