-
Notifications
You must be signed in to change notification settings - Fork 32
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: update react & react-dom to v17 #1009
Conversation
…n-portal into mashal-m/react-upgrade-to-v17
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1009 +/- ##
=======================================
Coverage 85.42% 85.42%
=======================================
Files 494 494
Lines 10604 10604
Branches 2214 2214
=======================================
Hits 9058 9058
Misses 1504 1504
Partials 42 42 ☔ View full report in Codecov by Sentry. |
…n-portal into mashal-m/react-upgrade-to-v17
/* Upgrading the @edx/paragon version from 20.41.0 to 20.42.0 | ||
caused this function to be called twice. Setting this to 2 in order to fix the test */ | ||
expect(sendEnterpriseTrackEvent).toHaveBeenCalledTimes(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this doesn't feel quite like a "fix"... If the component itself is calling sendEnterpriseTrackEvent
more than expected when the use toggled between these radio options (see screenshot), then that is a bug as it would skew the product analytics around this event (duplicate events for a single click).
Can this be reproduced on the Paragon component itself (i.e., onChange
callback function passed to Form.Radioset
)? If not, then it might be an issue with this repo's usage of the Paragon component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mashal-m I believe this is related to this Paragon bug and associated fix (in code review), and will apply to Paragon v21.
This same issue came up recently when trying to upgrade Paragon to latest v20 as well. We opted to defer on the Paragon latest v20 upgrade as this regression ends up causing duplicate success Toast
messages to appear within some of our features in this MFE...
[question] Is it possible to move forward with this PR without upgrading Paragon to latest v20 to avoid introducing this regression?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, got it. Thanks for clarifying. Luckily, the aforementioned bug preventing us from upgrading to latest v20, causing the issue with the duplicate onChange
calls was fixed and backported to v20.46.3 earlier today.
We should be able to move forward with upgrading to latest v20 at this point, without needing to update tests regarding expect(sendEnterpriseTrackEvent).toHaveBeenCalledTimes(2);
🤞
src/components/ContentHighlights/tests/ContentHighlightsCardItemsContainer.test.jsx
Outdated
Show resolved
Hide resolved
@@ -242,38 +242,40 @@ describe('Test authorization flows for Blackboard and Canvas', () => { | |||
expect(mockCanvasFetch).toHaveBeenCalledWith(1); | |||
}); | |||
test('Canvas config is activated after last step', async () => { | |||
renderWithRouter(<SettingsCanvasWrapper />); | |||
mockCanvasUpdate.mockResolvedValue({ data: mockCanvasResponseDataActive }); | |||
setTimeout(async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[curious] Why is a setTimeout
necessary here? It feels like a code smell that setTimeout
would be needed in a test like this when its used React Testing Library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initial issue was I ran into a "Null: create event" error when running this test file. The problem seemed to be with the last section. Async/await operations weren't working properly there, so I had to use setTimeout to add a small delay in order to clear the current stack.
I have made some changes for this particular test case (commit)
…n-portal into mashal-m/react-upgrade-to-v17
9d960b2
to
d8a0b20
Compare
…n-portal into mashal-m/react-upgrade-to-v17
I have pushed the requested changes and upgraded Paragon as well, we are good to go! |
…n-portal into mashal-m/react-upgrade-to-v17
…n-portal into mashal-m/react-upgrade-to-v17
66c3da9
to
f769c39
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did notice some failing tests in the PR.
For the EmailAddressTableCell.tests.jsx
failing tests, refactoring to the await waitFor syntax seemed to fix the issue with the enterprise track event count and could be used to fix up similar issues the tests are showing
await waitFor(() => expect(screen.findByText('Learner data disabled', { exact: false })));
await waitFor(() => expect(sendEnterpriseTrackEvent).toHaveBeenCalledTimes(1));
Great job refactoring to paragons Truncate
component 👍🏽
package.json
Outdated
"react-helmet": "5.2.1", | ||
"react": "17.0.2", | ||
"react-dom": "17.0.2", | ||
"react-helmet": "^6.1.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] I would pin this upgrade 👍🏽
Fixed the tests, it is ready for merge now. |
Ticket
Upgrade React JS to v17
Description
react
&react-dom
to v17 along withreact-test-renderer
,react-helmet
,react-textarea-autosize
,@testing-library/react
andreact-redux
to respective compatible versionsenzyme-adapter-react-16
with@wojtekmaj/enzyme-adapter-react-17
react-truncate
withreact-lines-ellipsis
due to dependency issues with react v17@edx/frontend-enterprise-catalog-search
,@edx/frontend-enterprise-hotjar
,@edx/frontend-enterprise-logistration
@edx/frontend-enterprise-utils
@edx/frontend-platform
, and@edx/paragon
For all changes
Only if submitting a visual change