mirror of
https://github.com/vrc-get/vrc-get.git
synced 2026-06-21 09:58:08 +00:00
fix: useRef without parameters
This commit is contained in:
parent
7dc08e93b1
commit
ad32047e13
2 changed files with 3 additions and 5 deletions
|
|
@ -58,7 +58,7 @@ function PageBody() {
|
|||
queryKey: ["environmentRepositoriesInfo"],
|
||||
queryFn: commands.environmentRepositoriesInfo,
|
||||
});
|
||||
const onFinishAddRepositoryCallbackRef = useRef<() => void>();
|
||||
const onFinishAddRepositoryCallbackRef = useRef<() => void>(undefined);
|
||||
|
||||
const addRepositoryInfo = useAddRepository({
|
||||
refetch: () => result.refetch(),
|
||||
|
|
|
|||
|
|
@ -7,12 +7,10 @@ import { useCallback, useRef } from "react";
|
|||
export function useEffectEvent<Args extends unknown[]>(
|
||||
listener: (...args: Args) => void,
|
||||
): (...args: Args) => void {
|
||||
const event = useRef<(...args: Args) => void>();
|
||||
const event = useRef<(...args: Args) => void>(listener);
|
||||
event.current = listener;
|
||||
|
||||
return useCallback((...args: Args) => {
|
||||
if (event.current) {
|
||||
event.current(...args);
|
||||
}
|
||||
event.current(...args);
|
||||
}, []);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue