diff --git a/src/Components/Profile/Templates/TabsForm.tsx b/src/Components/Profile/Templates/TabsForm.tsx index 9bb6ee06..35e48e2a 100644 --- a/src/Components/Profile/Templates/TabsForm.tsx +++ b/src/Components/Profile/Templates/TabsForm.tsx @@ -1,5 +1,5 @@ import { useCallback, useEffect, useState } from "react" -import { TextAreaInput, TextInput } from "../../Input" +import { TextAreaInput } from "../../Input" import { PopupStartEndInput, TextView } from "../../Map" import { ActionButton } from "../Subcomponents/ActionsButton" import { LinkedItemsHeaderView } from "../Subcomponents/LinkedItemsHeaderView" @@ -15,45 +15,49 @@ export const TabsForm = ({ item, state, setState, updatePermission, linkItem, un const updateActiveTab = useCallback((id: number) => { setActiveTab(id); - + let params = new URLSearchParams(window.location.search); params.set("tab", `${id}`); const newUrl = location.pathname + "?" + params.toString(); window.history.pushState({}, '', newUrl); setUrlParams(params); - }, [location.pathname]); - - useEffect(() => { + }, [location.pathname]); + + useEffect(() => { let params = new URLSearchParams(location.search); let urlTab = params.get("tab"); setActiveTab(urlTab ? Number(urlTab) : 1); - }, [location.search]); + }, [location.search]); return (