mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-23 13:39:54 +05:30
Close language switcher popup not earlier than locale will be loaded and applied
This commit is contained in:
parent
88c2eab802
commit
7a7d07203e
@ -17,9 +17,11 @@ const LanguageSwitcher: ComponentType<Props> = ({ onClose = () => {} }) => {
|
|||||||
|
|
||||||
const onChangeLang = useCallback(
|
const onChangeLang = useCallback(
|
||||||
(lang: string) => {
|
(lang: string) => {
|
||||||
dispatch(changeLang(lang));
|
Promise.all([
|
||||||
// TODO: await language change and close popup, but not earlier than after 300ms
|
// 300ms is necessary for the visual animation of the language change to be completed
|
||||||
setTimeout(onClose, 300);
|
new Promise((resolve) => setTimeout(resolve, 300)),
|
||||||
|
dispatch(changeLang(lang)),
|
||||||
|
]).then(onClose);
|
||||||
},
|
},
|
||||||
[dispatch, onClose],
|
[dispatch, onClose],
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user