mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-24 18:56:32 -05:00
change not to update state object
Signed-off-by: yamashush <38120991+yamashush@users.noreply.github.com>
This commit is contained in:
parent
cd01deca67
commit
8aa913c179
1 changed files with 4 additions and 4 deletions
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
import { useApplicationState } from '../../../../../../hooks/common/use-application-state'
|
import { useApplicationState } from '../../../../../../hooks/common/use-application-state'
|
||||||
|
import type { Alias } from '../../../../../../api/alias/types'
|
||||||
import type { ApplicationState } from '../../../../../../redux/application-state'
|
import type { ApplicationState } from '../../../../../../redux/application-state'
|
||||||
import { AliasesListEntry } from './aliases-list-entry'
|
import { AliasesListEntry } from './aliases-list-entry'
|
||||||
import React, { Fragment, useMemo } from 'react'
|
import React, { Fragment, useMemo } from 'react'
|
||||||
|
@ -13,13 +14,12 @@ import React, { Fragment, useMemo } from 'react'
|
||||||
*/
|
*/
|
||||||
export const AliasesList: React.FC = () => {
|
export const AliasesList: React.FC = () => {
|
||||||
const aliases = useApplicationState((state: ApplicationState) => state.noteDetails?.aliases)
|
const aliases = useApplicationState((state: ApplicationState) => state.noteDetails?.aliases)
|
||||||
|
|
||||||
const aliasesDom = useMemo(() => {
|
const aliasesDom = useMemo(() => {
|
||||||
return aliases === undefined
|
return aliases === undefined
|
||||||
? null
|
? null
|
||||||
: aliases
|
: Object.assign([], aliases)
|
||||||
.sort((a, b) => a.name.localeCompare(b.name))
|
.sort((a: Alias, b: Alias) => a.name.localeCompare(b.name))
|
||||||
.map((alias) => <AliasesListEntry alias={alias} key={alias.name} />)
|
.map((alias: Alias) => <AliasesListEntry alias={alias} key={alias.name} />)
|
||||||
}, [aliases])
|
}, [aliases])
|
||||||
|
|
||||||
return <Fragment>{aliasesDom}</Fragment>
|
return <Fragment>{aliasesDom}</Fragment>
|
||||||
|
|
Loading…
Reference in a new issue