From f95173e096c27638d207a937b51a9a75372e1d90 Mon Sep 17 00:00:00 2001 From: rvveber Date: Tue, 25 Feb 2025 15:42:18 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(frontend)=20allow=20left=20panel?= =?UTF-8?q?=20to=20update=20on=20language=20change?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fixes a bug where after language-sync the left panel would remain in the same language as before. --- .../components/LefPanelTargetFilters.tsx | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/frontend/apps/impress/src/features/left-panel/components/LefPanelTargetFilters.tsx b/src/frontend/apps/impress/src/features/left-panel/components/LefPanelTargetFilters.tsx index 47e7953a..1ffd3e70 100644 --- a/src/frontend/apps/impress/src/features/left-panel/components/LefPanelTargetFilters.tsx +++ b/src/frontend/apps/impress/src/features/left-panel/components/LefPanelTargetFilters.tsx @@ -1,5 +1,4 @@ import { usePathname, useRouter, useSearchParams } from 'next/navigation'; -import { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { css } from 'styled-components'; @@ -10,6 +9,7 @@ import { useLeftPanelStore } from '@/features/left-panel'; export const LeftPanelTargetFilters = () => { const { t } = useTranslation(); + const pathname = usePathname(); const { togglePanel } = useLeftPanelStore(); const { colorsTokens, spacingsTokens } = useCunninghamTheme(); @@ -23,25 +23,23 @@ export const LeftPanelTargetFilters = () => { const router = useRouter(); - const defaultQueries = useMemo(() => { - return [ - { - icon: 'apps', - label: t('All docs'), - targetQuery: DocDefaultFilter.ALL_DOCS, - }, - { - icon: 'lock', - label: t('My docs'), - targetQuery: DocDefaultFilter.MY_DOCS, - }, - { - icon: 'group', - label: t('Shared with me'), - targetQuery: DocDefaultFilter.SHARED_WITH_ME, - }, - ]; - }, [t]); + const defaultQueries = [ + { + icon: 'apps', + label: t('All docs'), + targetQuery: DocDefaultFilter.ALL_DOCS, + }, + { + icon: 'lock', + label: t('My docs'), + targetQuery: DocDefaultFilter.MY_DOCS, + }, + { + icon: 'group', + label: t('Shared with me'), + targetQuery: DocDefaultFilter.SHARED_WITH_ME, + }, + ]; const onSelectQuery = (query: DocDefaultFilter) => { const params = new URLSearchParams(searchParams);