From 8aa913c17941ac11f1f1974627969f57998f1d0d Mon Sep 17 00:00:00 2001 From: yamashush <38120991+yamashush@users.noreply.github.com> Date: Thu, 18 Jan 2024 19:30:09 +0900 Subject: [PATCH] change not to update state object Signed-off-by: yamashush <38120991+yamashush@users.noreply.github.com> --- .../aliases-sidebar-entry/aliases-modal/aliases-list.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/aliases-sidebar-entry/aliases-modal/aliases-list.tsx b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/aliases-sidebar-entry/aliases-modal/aliases-list.tsx index acd883ff8..aab779897 100644 --- a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/aliases-sidebar-entry/aliases-modal/aliases-list.tsx +++ b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/aliases-sidebar-entry/aliases-modal/aliases-list.tsx @@ -4,6 +4,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ import { useApplicationState } from '../../../../../../hooks/common/use-application-state' +import type { Alias } from '../../../../../../api/alias/types' import type { ApplicationState } from '../../../../../../redux/application-state' import { AliasesListEntry } from './aliases-list-entry' import React, { Fragment, useMemo } from 'react' @@ -13,13 +14,12 @@ import React, { Fragment, useMemo } from 'react' */ export const AliasesList: React.FC = () => { const aliases = useApplicationState((state: ApplicationState) => state.noteDetails?.aliases) - const aliasesDom = useMemo(() => { return aliases === undefined ? null - : aliases - .sort((a, b) => a.name.localeCompare(b.name)) - .map((alias) => ) + : Object.assign([], aliases) + .sort((a: Alias, b: Alias) => a.name.localeCompare(b.name)) + .map((alias: Alias) => ) }, [aliases]) return {aliasesDom}