fix: add useCallback
This commit is contained in:
parent
ef3256c6f9
commit
0907b2948c
|
@ -2,6 +2,7 @@ import {
|
||||||
createContext,
|
createContext,
|
||||||
createRef,
|
createRef,
|
||||||
forwardRef,
|
forwardRef,
|
||||||
|
useCallback,
|
||||||
useContext,
|
useContext,
|
||||||
useEffect,
|
useEffect,
|
||||||
useState,
|
useState,
|
||||||
|
@ -133,7 +134,7 @@ export function Navigator() {
|
||||||
const { isLoggedIn } = useAuth();
|
const { isLoggedIn } = useAuth();
|
||||||
const inputRef = createRef<HTMLInputElement>();
|
const inputRef = createRef<HTMLInputElement>();
|
||||||
|
|
||||||
const browse = () => {
|
const browse = useCallback(() => {
|
||||||
let input = inputRef.current?.value.trim();
|
let input = inputRef.current?.value.trim();
|
||||||
|
|
||||||
// If the input doesn't contain a protocol, assume it's http
|
// If the input doesn't contain a protocol, assume it's http
|
||||||
|
@ -153,7 +154,7 @@ export function Navigator() {
|
||||||
// Handle invalid URLs here, if needed
|
// Handle invalid URLs here, if needed
|
||||||
console.error("Invalid URL:", e);
|
console.error("Invalid URL:", e);
|
||||||
}
|
}
|
||||||
};
|
}, [inputRef, setUrl]);
|
||||||
|
|
||||||
const NavInput = forwardRef((props: any, ref) => (
|
const NavInput = forwardRef((props: any, ref) => (
|
||||||
<Input ref={ref} {...props}></Input>
|
<Input ref={ref} {...props}></Input>
|
||||||
|
|
Loading…
Reference in New Issue