mirror of
https://github.com/strapi/strapi.git
synced 2025-11-11 15:49:50 +00:00
Merge pull request #14239 from strapi/fix/cm-localepicker
CM: Fix i18n LocalePicker component
This commit is contained in:
commit
378ab81aee
@ -49,14 +49,24 @@ const LocalePicker = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch({ type: 'ContentManager/RBACManager/RESET_PERMISSIONS' });
|
|
||||||
|
|
||||||
setSelected(code);
|
setSelected(code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* if the selected value is set at the same time as the dispatcher
|
||||||
|
* is run, react might not have enough time to re-render the Select
|
||||||
|
* component, which leads to the `source` ref, which is passed to
|
||||||
|
* Popout, not being defined.
|
||||||
|
*
|
||||||
|
* By pushing the dispatcher to the end of the current execution
|
||||||
|
* context, we can guarantee the rendering can finish before.
|
||||||
|
*/
|
||||||
|
setTimeout(() => {
|
||||||
|
dispatch({ type: 'ContentManager/RBACManager/RESET_PERMISSIONS' });
|
||||||
setQuery({
|
setQuery({
|
||||||
page: 1,
|
page: 1,
|
||||||
plugins: { ...query.plugins, i18n: { locale: code } },
|
plugins: { ...query.plugins, i18n: { locale: code } },
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user