"the results could not be loaded" error condition doesn't work with timeout
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 25.9k
- Forks
- 6.1k
- Avg merge
- 8d 53m
- Merged PRs (30d)
- 4
Description
"the results could not be loaded" error condition is correctly generated for errors like 404, 500, but not for timeout condition
Minimal case:
Browse to http://localhost/select.html
Expected: After 1000 ms, "the results could not be loaded" is displayed right below dropdown
Actual: No error is displayed
sleep.php:
<?php
sleep (20);
select.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="select2.css" rel="stylesheet">
</head>
<body>
<select id="dropdown"></select>
<script src="jquery-3.7.1.js"></script>
<script src="select2.full.js"></script>
<script>
$(function(){
$('#dropdown').select2({
debug:true,
ajax: {
url: '/sleep.php',
timeout: 1000,
error: function(a,b,c) {
console.log("oops");
},
data: function (params) {
return {
query: params.term
}
},
},
width: "50%"
})
});
</script>
</body>
</html>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the timeout with the provided select.html and sleep.php case, then inspect the AJAX timeout and error-handling path in select2.full.js. Confirm that a 1000 ms timeout displays "the results could not be loaded" below the dropdown, while the existing 404 and 500 behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, jquery
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100