Skip to content

Commit 300e7d5

Browse files
committed
fix: refresh hostname filter without observer
fixes d45c19b
1 parent 9cdb662 commit 300e7d5

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/datadistributor.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,13 @@ export const DataDistributor = function () {
6767
refresh();
6868
}
6969

70-
function refresh() {
70+
function refresh(withoutObservers?: boolean) {
7171
if (data === undefined) {
7272
return;
7373
}
74-
notifyObservers();
74+
if (!withoutObservers) {
75+
notifyObservers();
76+
}
7577

7678
let filter: FilterMethod = filters.reduce(
7779
function (a: FilterMethod, filter) {

lib/filters/hostname.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ import { CanRender } from "../container.js";
44
import { Filter } from "../datadistributor.js";
55

66
export const HostnameFilter = function (): CanRender & Filter {
7-
let refreshFunctions: (() => any)[] = [];
7+
let refreshFunctions: ((bool?) => any)[] = [];
88
let timer: ReturnType<typeof setTimeout>;
99
let input = document.createElement("input");
1010

1111
function refresh() {
1212
clearTimeout(timer);
1313
timer = setTimeout(function () {
1414
refreshFunctions.forEach(function (f) {
15-
f();
15+
// observer gui function recreates the filter this removes the input focus
16+
// the hostname filter should therefore not notifyObservers on refresh
17+
f(true);
1618
});
1719
}, 250);
1820
}

0 commit comments

Comments
 (0)