react
react copied to clipboard
[BUG] Form does not change language when options change
Environment
Please provide as many details as you can:
- Hosting type
- [] Form.io
- [x] Local deployment
- Version: Latest
- Formio.js version: Latest
- Frontend framework: React
- Browser: Firefox latest
- Browser version: latest
Steps to Reproduce
- Use React and Formio with i18next.
- Configure everything something like this:
const options = {
i18n: {
[i18n.language]: i18n.getResourceBundle(i18n.language, 'translation'),
},
language: i18n.language,
hooks: {},
};
// https://help.form.io/developers/form-renderer#form-renderer-options
return (
<>
<Form
src={url}
onSubmitDone={onSubmitDone}
formReady={onFormReady}
options={options}
/>
{isReady ? null : <LoadingSpinner animation="border" />}
</>
);
- Change the language
Expected behavior
- Language changes in the form
Observed behavior
- Language does not change
This can be hack-fixed by amending Form.jsx
, https://github.com/formio/react/blob/e9d61b0dc7ec45be966fd57b92c41e9b9f8483ab/src/components/Form.jsx#L62
useEffect(() => {
const { src } = props;
if (src) {
createWebformInstance(src).then(() => {
if (formio) {
formio.src = src;
}
});
initializeFormio();
}
}, [props.src, props.options]);
hi @madflow can you assign me here?
@rijusougata13 No, I cannot assign you.
@madflow @rijusougata13 Is there a solution for this problem. I am facing the same issue. Thanks
We added this for our Monday planning to get this prioritized. Thanks.
Having the same issue.