Skip to content

Commit b031784

Browse files
committed
fix(toolbar): dont run setTimeout on every render
1 parent 7086b5c commit b031784

File tree

1 file changed

+2
-5
lines changed
  • packages/scan/src/core/web/components/widget

1 file changed

+2
-5
lines changed

packages/scan/src/core/web/components/widget/header.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,16 @@ export const Header = () => {
116116
}, []);
117117

118118
useEffect(() => {
119-
const debouncedUpdate = debounce(updateHeaderContent, 16, { leading: true });
120-
121-
const unsubscribeLastReportTime = Store.lastReportTime.subscribe(debouncedUpdate);
119+
const unsubscribeLastReportTime = Store.lastReportTime.subscribe(updateHeaderContent);
122120
const unsubscribeStoreInspectState = Store.inspectState.subscribe(state => {
123121
if (state.kind === 'focused') {
124-
debouncedUpdate();
122+
updateHeaderContent();
125123
}
126124
});
127125

128126
return () => {
129127
unsubscribeLastReportTime();
130128
unsubscribeStoreInspectState();
131-
debouncedUpdate.cancel?.();
132129
};
133130
}, [updateHeaderContent]);
134131

0 commit comments

Comments
 (0)