fix: remove callback caching
This commit is contained in:
parent
88c7bf5ec5
commit
e7c40cdf32
|
@ -134,7 +134,7 @@ export function Navigator() {
|
||||||
const { isLoggedIn } = useAuth();
|
const { isLoggedIn } = useAuth();
|
||||||
const [inputValue, setInputValue] = useState(contextUrl); // Local state for the input value
|
const [inputValue, setInputValue] = useState(contextUrl); // Local state for the input value
|
||||||
|
|
||||||
const browse = useCallback(() => {
|
const browse = () => {
|
||||||
let input = inputValue.trim();
|
let input = inputValue.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
|
||||||
|
@ -154,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);
|
||||||
}
|
}
|
||||||
}, [contextUrl, setUrl]);
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setInputValue(contextUrl); // Update local state when context's url changes
|
setInputValue(contextUrl); // Update local state when context's url changes
|
||||||
|
@ -170,10 +170,7 @@ export function Navigator() {
|
||||||
<>
|
<>
|
||||||
<NavInput
|
<NavInput
|
||||||
value={inputValue}
|
value={inputValue}
|
||||||
onChange={(e: any) => {
|
onChange={(e: any) => setInputValue(e.target.value)}
|
||||||
debugger;
|
|
||||||
setInputValue(e.target.value);
|
|
||||||
}}
|
|
||||||
disabled={!isLoggedIn}
|
disabled={!isLoggedIn}
|
||||||
/>
|
/>
|
||||||
<Button onClick={browse} disabled={!isLoggedIn}>
|
<Button onClick={browse} disabled={!isLoggedIn}>
|
||||||
|
|
Loading…
Reference in New Issue