Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Nov 4, 2024
1 parent 88c8ef7 commit 4b39075
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions packages/desktop-client/src/components/ScrollProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ type ScrollListenerArgs = {

type ScrollListener = (args: ScrollListenerArgs) => void;
type UnregisterScrollListener = () => void;
type RegisterScrollListener = (listener: ScrollListener) => UnregisterScrollListener;
type RegisterScrollListener = (
listener: ScrollListener,
) => UnregisterScrollListener;

type IScrollContext = {
registerScrollListener: RegisterScrollListener;
Expand Down Expand Up @@ -176,13 +178,16 @@ export function ScrollProvider<T extends Element>({
});
}, [hasScrolledToEnd, isDisabled, isScrolling, scrollableRef]);

const registerScrollListener: RegisterScrollListener = useCallback(listener => {
listeners.current.push(listener);
const registerScrollListener: RegisterScrollListener = useCallback(
listener => {
listeners.current.push(listener);

return () => {
listeners.current = listeners.current.filter(l => l !== listener);
};
}, []);
return () => {
listeners.current = listeners.current.filter(l => l !== listener);
};
},
[],
);

return (
<ScrollContext.Provider value={{ registerScrollListener }}>
Expand Down

0 comments on commit 4b39075

Please sign in to comment.