Fix SForms IntlProvider error by using React Intl context directly #278
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Starting from s-forms version 0.8.1-alpha-0838f82.0, the library requires the React
IntlProviderto be in the component ancestry and expects the intl object to have methods likeformatMessage,formatDate, etc. The previous implementation was passing a simple object structure through options, which caused the error:Root Cause
state.intl(from Redux) instead of the actual React Intl object frominjectIntlI18nStore.getIntl()which returned the wrong intl object structureChanges Made
MainView.jsx
intl: state.intlfrommapStateToPropsso thatthis.props.intlnow comes from theinjectIntlHOCRecordForm.jsx
intl: I18nStore.getIntl()tointl: this.props.intlto pass the actual React Intl object to SFormsintl: PropTypes.objectto properly type the intl propBefore vs After
Before: s-forms received a simple object like:
After: s-forms receives a full React Intl object with:
This fix ensures that SForms receives the proper React Intl object while maintaining backward compatibility with existing functionality.
Fixes #277.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
kbss.felk.cvut.cznpm install(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.