Skip to content

Commit 5c4052a

Browse files
authored
fix search bar (#174)
1 parent 9b0c3e0 commit 5c4052a

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/renderer/components/TopBar.tsx

+5-9
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ const TopBar: FC = () => {
2121
};
2222

2323
const fetch = () => {
24+
ipcRenderer.once(GET_ALL_RECORDS, (_e, args) => {
25+
if (!args.err) {
26+
setConnections(args.res.records);
27+
}
28+
});
2429
ipcRenderer.send(GET_ALL_RECORDS);
2530
};
2631

@@ -32,16 +37,7 @@ const TopBar: FC = () => {
3237
});
3338

3439
useEffect(() => {
35-
ipcRenderer.on(GET_ALL_RECORDS, (_e, args) => {
36-
if (!args.err) {
37-
setConnections(args.res.records);
38-
}
39-
});
4040
fetch();
41-
42-
return function cleanup() {
43-
ipcRenderer.removeAllListeners(GET_ALL_RECORDS);
44-
};
4541
}, []);
4642

4743
return (

0 commit comments

Comments
 (0)