mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-21 16:27:19 +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
|
||||
let lastSearchText = '';
|
||||
searchInputEl.addEventListener('keyup', debounce(() => {
|
||||
const text = searchInputEl.value
|
||||
// sanitize input
|
||||
.replace(/[(\?|\&\{\}\(\))]/gi, '')
|
||||
.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
|
||||
: '#all';
|
||||
// Only apply filter if hash has changed
|
||||
if (newHash !== window.location.hash) {
|
||||
history.pushState('', '', newHash);
|
||||
applyFilter();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user