Skip to content

Commit

Permalink
Add disposer cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: DmitriyNoa <dmytro.zharkov@gmail.com>
  • Loading branch information
DmitriyNoa committed Jan 31, 2022
1 parent 8674f3e commit 70c3d03
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/renderer/components/dock/dock-tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,12 @@ export const DockTabs = ({ tabs, autoFocus, selectedTab, onChangeTab, dockStore
window.addEventListener("resize", onWindowResize);

// update scroll state if tabs numbers has changed
reaction(() => dockStore.tabsNumber, updateStateValues);
const onTabsNumberChangedDisposer = reaction(() => dockStore.tabsNumber, updateStateValues);

return () => {
window.removeEventListener("resize", onWindowResize);
elem.current.removeEventListener("scroll", updateScrollPosition);
onTabsNumberChangedDisposer();
};
}, []);

Expand Down

0 comments on commit 70c3d03

Please sign in to comment.