feat: memoize handle url change
This commit is contained in:
@@ -78,7 +78,7 @@ export const BrowserContent = () => {
|
|||||||
[socket]
|
[socket]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleUrlChanged = (url: string) => {
|
const handleUrlChanged = useCallback((url: string) => {
|
||||||
const parsedUrl = new URL(url);
|
const parsedUrl = new URL(url);
|
||||||
if (parsedUrl.hostname) {
|
if (parsedUrl.hostname) {
|
||||||
const host = parsedUrl.hostname
|
const host = parsedUrl.hostname
|
||||||
@@ -100,7 +100,7 @@ export const BrowserContent = () => {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}, [tabs, tabIndex]);
|
||||||
|
|
||||||
const tabHasBeenClosedHandler = useCallback(
|
const tabHasBeenClosedHandler = useCallback(
|
||||||
(index: number) => {
|
(index: number) => {
|
||||||
@@ -132,7 +132,7 @@ export const BrowserContent = () => {
|
|||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log("Fetching current url failed");
|
console.log("Fetching current url failed");
|
||||||
});
|
});
|
||||||
}, [handleUrlChanged]);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div id="browser">
|
<div id="browser">
|
||||||
|
|||||||
Reference in New Issue
Block a user