feat: memoize handle url change

This commit is contained in:
Rohit
2025-04-29 00:30:50 +05:30
parent a00e69e40a
commit a7771cfa9b

View File

@@ -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">