mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
refactor(console): refresh preview on custom phrases updated (#2083)
This commit is contained in:
parent
691bdb3ac9
commit
a2d59cd0ff
2 changed files with 4 additions and 2 deletions
|
@ -27,6 +27,7 @@ const useUiLanguages = () => {
|
|||
);
|
||||
|
||||
return {
|
||||
customPhrases: customPhraseList,
|
||||
languages,
|
||||
error,
|
||||
isLoading: !customPhraseList && !error,
|
||||
|
|
|
@ -33,6 +33,7 @@ const Preview = ({ signInExperience, className }: Props) => {
|
|||
const [platform, setPlatform] = useState<'desktopWeb' | 'mobile' | 'mobileWeb'>('desktopWeb');
|
||||
const { data: allConnectors } = useSWR<ConnectorResponse[], RequestError>('/api/connectors');
|
||||
const previewRef = useRef<HTMLIFrameElement>(null);
|
||||
const { customPhrases } = useUiLanguages();
|
||||
|
||||
const { languages } = useUiLanguages();
|
||||
|
||||
|
@ -109,7 +110,7 @@ const Preview = ({ signInExperience, className }: Props) => {
|
|||
}, [allConnectors, language, mode, platform, signInExperience]);
|
||||
|
||||
const postPreviewMessage = useCallback(() => {
|
||||
if (!config) {
|
||||
if (!config || !customPhrases) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -117,7 +118,7 @@ const Preview = ({ signInExperience, className }: Props) => {
|
|||
{ sender: 'ac_preview', config },
|
||||
window.location.origin
|
||||
);
|
||||
}, [config]);
|
||||
}, [config, customPhrases]);
|
||||
|
||||
useEffect(() => {
|
||||
postPreviewMessage();
|
||||
|
|
Loading…
Reference in a new issue