Skip to content

[Search] - Ajax abort not correct "there was an issue querying the server." #2779

Closed
@ayurmedia

Description

Steps to Reproduce

  1. use searchfield with .ui.search and remote api
  2. type some searchwords
  3. quickly change the searchwords to trigger an ajax abort
  4. it starts a new api search
  5. it shows server-error because of the bug

Expected
The Search should do this:

  1. Enter word, start search via ajax (ok)
  2. Enter another word, abort ajax (ok)
  3. Start another request (ok)
  4. show results of the new request (broken)

Result
The Search does not do this:

  1. The search shows server error, but should show result
  2. ajax abort does not work on instance but globally on module.request

Bug is somewhere module.request.rejectWith, which will break ajax requests after this
$api.search.query.event.fail...
if one returns in fail() then search works like expected.

Testcase
the bug can be reproduced on the semantic-ui page:
http://semantic-ui.com/modules/search.html
screen shot 2015-08-04 at 18 15 45

when you quickly type different words in the searchbox you can produce "abort". (unfortunately semantic-ui-com often responds with 502 Bad Gateway, but it should be abort.

the GET is Aborted, and another GET is successful.
the API Debug now should trigger the display of the results, but because of global vars or a race-condition the second Ajax request also shows API => "API request failed" which is the cause of the Bug.
the error-message of the first GET gets copied over to the second GET (ajax) request and then shows the server-error, which is wrong, because the second request was successful.

if the callback of $api.search.query.event.fail: function()... returns early then the result-list will be shown.

to turn on debug log in js-console on semantic-ui website enter following in the javascript-console.

$('.ui.search').search({'debug':1,'verbose':1,'cache':0});

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions