fix: remove callback caching

This commit is contained in:
Derrick Hammer 2023-10-16 18:37:10 -04:00
parent 88c7bf5ec5
commit e7c40cdf32
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 6 deletions

View File

@ -134,7 +134,7 @@ export function Navigator() {
const { isLoggedIn } = useAuth();
const [inputValue, setInputValue] = useState(contextUrl); // Local state for the input value
const browse = useCallback(() => {
const browse = () => {
let input = inputValue.trim();
// If the input doesn't contain a protocol, assume it's http
@ -154,7 +154,7 @@ export function Navigator() {
// Handle invalid URLs here, if needed
console.error("Invalid URL:", e);
}
}, [contextUrl, setUrl]);
};
useEffect(() => {
setInputValue(contextUrl); // Update local state when context's url changes
@ -170,10 +170,7 @@ export function Navigator() {
<>
<NavInput
value={inputValue}
onChange={(e: any) => {
debugger;
setInputValue(e.target.value);
}}
onChange={(e: any) => setInputValue(e.target.value)}
disabled={!isLoggedIn}
/>
<Button onClick={browse} disabled={!isLoggedIn}>