From 4bf0555ece29fad429eb967711007d1fb29abd82 Mon Sep 17 00:00:00 2001 From: LASER-Yi Date: Mon, 21 Feb 2022 22:06:42 +0800 Subject: [PATCH] Fix a issue that language profiles won't show in some situations --- frontend/src/pages/Settings/Languages/table.tsx | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/frontend/src/pages/Settings/Languages/table.tsx b/frontend/src/pages/Settings/Languages/table.tsx index 7c5dd0121..20e54bf53 100644 --- a/frontend/src/pages/Settings/Languages/table.tsx +++ b/frontend/src/pages/Settings/Languages/table.tsx @@ -1,12 +1,7 @@ import { faTrash, faWrench } from "@fortawesome/free-solid-svg-icons"; import { ActionButton, SimpleTable, useShowModal } from "components"; import { cloneDeep } from "lodash"; -import React, { - FunctionComponent, - useCallback, - useMemo, - useState, -} from "react"; +import React, { FunctionComponent, useCallback, useMemo } from "react"; import { Badge, Button, ButtonGroup } from "react-bootstrap"; import { Column, TableUpdater } from "react-table"; import { useEnabledLanguagesContext, useProfilesContext } from "."; @@ -16,12 +11,10 @@ import Modal from "./modal"; import { anyCutoff } from "./options"; const Table: FunctionComponent = () => { - const originalProfiles = useProfilesContext(); + const profiles = useProfilesContext(); const languages = useEnabledLanguagesContext(); - const [profiles, setProfiles] = useState(() => cloneDeep(originalProfiles)); - const nextProfileId = useMemo( () => 1 + @@ -36,7 +29,6 @@ const Table: FunctionComponent = () => { const submitProfiles = useCallback( (list: Language.Profile[]) => { update(list, languageProfileKey); - setProfiles(list); }, [update] );