Skip to content

Commit c924b2a

Browse files
committed
revert handleChange
1 parent 67a6c32 commit c924b2a

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/index.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,12 @@ export function useContext<Value, Selected>(
100100
[selector],
101101
);
102102
const subscribe = useCallback((
103-
ref: MutableRefObject<{ value: Value; listeners: Set<() => void> }>,
104-
handleCallback: (snapshot: Selected) => void,
103+
ref: MutableRefObject<{ listeners: Set<() => void> }>,
104+
callback: () => void,
105105
) => {
106-
const listener = () => {
107-
handleCallback(getSnapshot(ref));
108-
};
109106
const { listeners } = ref.current;
110-
listeners.add(listener);
111-
return () => listeners.delete(listener);
112-
}, [getSnapshot]);
107+
listeners.add(callback);
108+
return () => listeners.delete(callback);
109+
}, []);
113110
return useMutableSource(source, getSnapshot, subscribe);
114111
}

0 commit comments

Comments
 (0)