fix: update hash routing logic (#1082)

This commit is contained in:
Mamadou DICKO 2023-08-31 18:08:39 +02:00 committed by GitHub
parent 47b8d697c6
commit 51bd020a2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
import { UUID } from "crypto";
import { useParams, useRouter } from "next/navigation";
import { useState } from "react";
import { useEffect, useState } from "react";
import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext";
@ -9,9 +9,15 @@ import { getTargetedTab } from "../utils/getTargetedTab";
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const useBrainManagementTabs = () => {
const [selectedTab, setSelectedTab] = useState<BrainManagementTab>(
getTargetedTab() ?? "settings"
);
const [selectedTab, setSelectedTab] =
useState<BrainManagementTab>("settings");
useEffect(() => {
const targetedTab = getTargetedTab();
if (targetedTab !== undefined) {
setSelectedTab(targetedTab);
}
}, []);
const { deleteBrain, setCurrentBrainId } = useBrainContext();
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);