mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
fix(console): set undefined value to empty string in custom phrases (#2074)
This commit is contained in:
parent
68e88840bf
commit
81f9fbc483
3 changed files with 5 additions and 4 deletions
|
@ -48,6 +48,7 @@
|
|||
"cross-env": "^7.0.3",
|
||||
"csstype": "^3.0.11",
|
||||
"dayjs": "^1.10.5",
|
||||
"deepmerge": "^4.2.2",
|
||||
"dnd-core": "^16.0.0",
|
||||
"eslint": "^8.21.0",
|
||||
"history": "^5.3.0",
|
||||
|
|
|
@ -3,6 +3,7 @@ import resource, { isBuiltInLanguageTag } from '@logto/phrases-ui';
|
|||
import en from '@logto/phrases-ui/lib/locales/en';
|
||||
import { SignInExperience, Translation } from '@logto/schemas';
|
||||
import cleanDeep from 'clean-deep';
|
||||
import deepmerge from 'deepmerge';
|
||||
import { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
||||
import { FormProvider, useForm } from 'react-hook-form';
|
||||
import { toast } from 'react-hot-toast';
|
||||
|
@ -56,10 +57,7 @@ const LanguageEditor = () => {
|
|||
);
|
||||
|
||||
const defaultFormValues = useMemo(
|
||||
() =>
|
||||
customPhrase && Object.keys(customPhrase.translation).length > 0
|
||||
? customPhrase.translation
|
||||
: emptyUiTranslation,
|
||||
() => deepmerge(emptyUiTranslation, customPhrase?.translation ?? {}),
|
||||
[customPhrase]
|
||||
);
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ importers:
|
|||
cross-env: ^7.0.3
|
||||
csstype: ^3.0.11
|
||||
dayjs: ^1.10.5
|
||||
deepmerge: ^4.2.2
|
||||
dnd-core: ^16.0.0
|
||||
eslint: ^8.21.0
|
||||
history: ^5.3.0
|
||||
|
@ -117,6 +118,7 @@ importers:
|
|||
cross-env: 7.0.3
|
||||
csstype: 3.0.11
|
||||
dayjs: 1.10.7
|
||||
deepmerge: 4.2.2
|
||||
dnd-core: 16.0.0
|
||||
eslint: 8.21.0
|
||||
history: 5.3.0
|
||||
|
|
Loading…
Reference in a new issue