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

feat: Initial changes to support OEP65 #535

Closed
wants to merge 3 commits into from

Conversation

pedromartello
Copy link
Contributor

@pedromartello pedromartello commented Aug 10, 2023

Description:

This pull request introduces changes to support the use of Piral the micro-frontend framework used in the prototype for OEP-65 - currently referred to OEPXXXX.

Specific changes introduced:

  • Upgrade the react-intl dependency to 6.4.4. The previous version 5.25.1 is incompatible with Piral and generated errors in the React component hierarchy.
  • Upgrade redux to 8.1.1. The previous version 7.1.1 is incompatible with Piral and generated errors where the Redux store was not available during component rendering.
  • Refactored and exposed the internal function mergeMessages. Previously this method would overwrite existing messages with the new messages. The new version overloads this function to actually merge new messages with existing ones.
  • Reordered initialization so that internationalization is loaded before authentication since authentication errors messages require internationalization to be loaded.
  • Bumped version of @edx/paragon to ^21.1.2 to resolve dependency conflicts with the versions of react-intl and react-redux above

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Aug 10, 2023
@openedx-webhooks
Copy link

openedx-webhooks commented Aug 10, 2023

Thanks for the pull request, @pedromartello! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@mphilbrick211 mphilbrick211 added the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Aug 15, 2023
@e0d
Copy link

e0d commented Aug 16, 2023

@pedromartello looks like there are some test failures. I realize this is still draft, but wanted to mention.

@e0d e0d removed the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Aug 16, 2023
@pedromartello
Copy link
Contributor Author

pedromartello commented Aug 16, 2023

@pedromartello looks like there are some test failures. I realize this is still draft, but wanted to mention.

@e0d This is an npm dependency failure: frontend-platform has a dependency on paragon which in turn declares a dependency on [email protected]. The related change to paragon in this PR: has passed tests. I don't think I can declare the dependency as 5.25.1 || 6.4.4 as that would break downstream projects that depend on 6.4.4.

Wondering if @arbrandes has a recommendation as he was looking at a related concern before I issued a PR for openedx/frontend-app-shell

EDIT: I marked the related PR in paragon "Ready for Review". When that PR is merged I can update the dependency to paragon from this project so that these tests pass too.

@pedromartello
Copy link
Contributor Author

@e0d @arbrandes - I moved this PR to "ready for review" as the required changes to paragon have been merged and released.

Copy link
Contributor

@arbrandes arbrandes left a comment

Choose a reason for hiding this comment

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

No objections in principle, but I think it's best to separate out these changes into different commits:

  • One for the redux update, with a message linking to the 8.0.0 changelog (this one) noting that there are no (known) breaking changes
  • Another for the react-intl upgrade, with a similar message
  • A third one for the mergeMessages() change (or new function, depending)
  • A fourth for the reordering of the configureI18n stanza, with an explanation.

These might have all been separate PRs, but I don't think we need to go that far unless somebody objects.

return Array.isArray(messagesArray) ? merge({}, ...messagesArray) : {};
export function mergeMessages(newMessages) {
const msgs = Array.isArray(newMessages) ? merge({}, ...newMessages) : newMessages;
messages = merge(messages, msgs);
Copy link
Contributor

Choose a reason for hiding this comment

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

Doing this would change the expected behavior of the function. Do we know if any other packages/MFEs use it?

Maybe it's best to create a new function for this purpose, just in case. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see my comment below

@@ -262,7 +265,7 @@ export function configure(options) {
loggingService = options.loggingService;
// eslint-disable-next-line prefer-destructuring
config = options.config;
messages = Array.isArray(options.messages) ? mergeMessages(options.messages) : options.messages;
messages = Array.isArray(options.messages) ? merge({}, ...options.messages) : options.messages;
Copy link
Contributor Author

@pedromartello pedromartello Aug 25, 2023

Choose a reason for hiding this comment

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

@arbrandes - the only use of the mergeMessages function was here (and in the unit tests). Note how it has now been changed to use lodash.merge directly. The exports from @edx/frontend-platform and @edx/frontend-platform/i18n were added in this commit.

@pedromartello
Copy link
Contributor Author

Closing to follow the suggestions in this comment: #535 (review)

@openedx-webhooks
Copy link

@pedromartello Even though your pull request wasn’t merged, please take a moment to answer a two question survey so we can improve your experience in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants