mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 09:17:06 +00:00
Preserve integration category filter on noop keyup (#36844)
This commit is contained in:
parent
ce61d721ff
commit
25715f712f
@ -309,17 +309,19 @@ allComponents.pop(); // remove placeholder element at the end
|
|||||||
};
|
};
|
||||||
|
|
||||||
// update view by search text
|
// update view by search text
|
||||||
|
let lastSearchText = '';
|
||||||
searchInputEl.addEventListener('keyup', debounce(() => {
|
searchInputEl.addEventListener('keyup', debounce(() => {
|
||||||
const text = searchInputEl.value
|
const text = searchInputEl.value
|
||||||
// sanitize input
|
// sanitize input
|
||||||
.replace(/[(\?|\&\{\}\(\))]/gi, '')
|
.replace(/[(\?|\&\{\}\(\))]/gi, '')
|
||||||
.trim();
|
.trim();
|
||||||
|
|
||||||
let newHash = typeof text === "string" && text.length >= 1
|
// Only apply filter if value has changed
|
||||||
|
if (lastSearchText !== text) {
|
||||||
|
lastSearchText = text;
|
||||||
|
const newHash = typeof text === "string" && text.length >= 1
|
||||||
? SEARCH_PREFIX + text
|
? SEARCH_PREFIX + text
|
||||||
: '#all';
|
: '#all';
|
||||||
// Only apply filter if hash has changed
|
|
||||||
if (newHash !== window.location.hash) {
|
|
||||||
history.pushState('', '', newHash);
|
history.pushState('', '', newHash);
|
||||||
applyFilter();
|
applyFilter();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user