Skip to content

Commit 96b9e8e

Browse files
committed
Revert "Permalink optimization: Avoid worker at initial load"
This reverts commit 976b0a3. This change caused a bug: An opened permalink did not jump to the search result any more, because textSearchEngine.getCurrentSearchTerm() returned null as the result of not starting a search query.
1 parent 976b0a3 commit 96b9e8e

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

src/crxviewer.js

+2-15
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ function renderInitialViewFromUrlParams() {
11221122
fileFilterElem.value = q;
11231123

11241124
// Hide all files in the UI that do not match the query.
1125-
checkAndApplyFilter(true);
1125+
checkAndApplyFilter();
11261126
if (fileFilterElem.classList.contains('invalid')) {
11271127
// The query is invalid. Don't bother with searching.
11281128
return;
@@ -1144,14 +1144,7 @@ function renderInitialViewFromUrlParams() {
11441144
console.warn('No entry found with name ' + qf);
11451145
return;
11461146
}
1147-
if (unfilteredItems.length === 1 && unfilteredItems[0] === selectedItem) {
1148-
// Optimization: Do not initialize the worker for TextSearchEngine when a file
1149-
// was explicitly selected and it is the only matching file.
1150-
// If the file does not match the grep pattern, then it will
1151-
// mistakenly be shown, but only initially. When the user modifies
1152-
// the search, the file will be hidden as expected, if needed.
1153-
checkAndApplyFilter.cancelDebouncedGrep();
1154-
} else if ([].indexOf.call(unfilteredItems, selectedItem) === -1) {
1147+
if ([].indexOf.call(unfilteredItems, selectedItem) === -1) {
11551148
console.warn('The selected item is invisible because it did not match the search filter.');
11561149
}
11571150
} else if (unfilteredItems.length === 1) {
@@ -1364,12 +1357,6 @@ var checkAndApplyFilter = (function() {
13641357
grepSearch(grepTerm);
13651358
}
13661359
}
1367-
checkAndApplyFilter.cancelDebouncedGrep = function() {
1368-
if (debounceGrep) {
1369-
clearTimeout(debounceGrep);
1370-
debounceGrep = null;
1371-
}
1372-
};
13731360
(function() {
13741361
// Bind to checkbox filter
13751362
//#if CHROME || OPERA || FIREFOX

0 commit comments

Comments
 (0)