0
Fork 0
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:
Xiao Yijun 2022-10-09 16:47:05 +08:00 committed by GitHub
parent 68e88840bf
commit 81f9fbc483
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View file

@ -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",

View file

@ -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]
);

View file

@ -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