Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wrap ErrorPage with IntlProvider and pass messages #353

Merged
merged 4 commits into from
Aug 2, 2022

Conversation

adamstankiewicz
Copy link
Member

@adamstankiewicz adamstankiewicz commented Aug 1, 2022

Description:

The ErrorPage relies on translated messages via react-intl's FormattedMessage component. However, it currently relies on consumers (i.e., MFEs) to wrap ErrorPage with an IntlProvider and pass a locale and messages prop. Instead, this PR proposes adding an IntlProvider to ErrorPage, pre-configuring its locale and messages props from the existing configuration in @edx/frontend-platform via its initialization.

Merge checklist:

  • Consider running your code modifications in the included example app within frontend-platform. This can be done by running npm start and opening http://localhost:8080.
  • Consider testing your code modifications in another local micro-frontend using local aliases configured via the module.config.js file in frontend-build.
  • Verify your commit title/body conforms to the conventional commits format (e.g., fix, feat) and is appropriate for your code change. Consider whether your code is a breaking change, and modify your commit accordingly.

Post merge:

  • After the build finishes for the merged commit, verify the new release has been pushed to NPM.

@adamstankiewicz adamstankiewicz force-pushed the ags/add-intlprovider-error-page branch from 092951e to 0cb10d9 Compare August 1, 2022 14:51
@@ -33,7 +32,7 @@ subscribe(APP_READY, () => {
});

subscribe(APP_INIT_ERROR, (error) => {
ReactDOM.render(<IntlProvider><ErrorPage message={error.message} /></IntlProvider>, document.getElementById('root'));
ReactDOM.render(<ErrorPage message={error.message} />, document.getElementById('root'));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ErrorPage includes IntlProvider already now.

@codecov
Copy link

codecov bot commented Aug 1, 2022

Codecov Report

Merging #353 (82c13b5) into master (992094d) will increase coverage by 0.14%.
The diff coverage is 80.00%.

@@            Coverage Diff             @@
##           master     #353      +/-   ##
==========================================
+ Coverage   81.24%   81.39%   +0.14%     
==========================================
  Files          38       38              
  Lines         917      919       +2     
  Branches      170      170              
==========================================
+ Hits          745      748       +3     
+ Misses        160      159       -1     
  Partials       12       12              
Impacted Files Coverage Δ
src/react/ErrorPage.jsx 77.77% <80.00%> (-7.94%) ⬇️
src/logging/interface.js 83.33% <0.00%> (+11.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 992094d...82c13b5. Read the comment docs.

Copy link

@pshiu pshiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a frontend expert, but this looks great and we definitely need this downstream!

@adamstankiewicz adamstankiewicz merged commit ef8baa3 into master Aug 2, 2022
@adamstankiewicz adamstankiewicz deleted the ags/add-intlprovider-error-page branch August 2, 2022 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants