-
Notifications
You must be signed in to change notification settings - Fork 25
fix: page routes wildcard which breaks tutor #322
fix: page routes wildcard which breaks tutor #322
Conversation
I see the test failures, but don't understand them. Does it shed light on why the wildcard was added? |
18ac379
to
44195fb
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #322 +/- ##
=======================================
Coverage 52.41% 52.41%
=======================================
Files 75 75
Lines 1986 1986
Branches 359 359
=======================================
Hits 1041 1041
Misses 912 912
Partials 33 33 ☔ View full report in Codecov by Sentry. |
Hi @connorhaugh, @Syed-Ali-Abbas-Zaidi is on leaves this week. Actually this route wasn't using |
@@ -52,7 +52,7 @@ subscribe(APP_READY, () => { | |||
<Route path={ROUTES.Detail.EDIT} element={<LibraryEditPage />} /> | |||
<Route path={ROUTES.Detail.ACCESS} element={<LibraryAccessPage />} /> | |||
<Route path={ROUTES.Detail.IMPORT} element={<CourseImportPage />} /> | |||
<Route path={`${ROUTES.Block.HOME}/*`} element={<LibraryBlockPage />} /> | |||
<Route path={`${ROUTES.Block.HOME}`} element={<LibraryBlockPage />} /> |
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.
don't revert this one, this route has child routes
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.
@ormsbee any chance you could test this out on Tutor with the wildcard in this route?
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.
Sure.
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 actually get the same error either way. Not sure if I'm doing something wrong. 😦
react.development.js:220 Warning: Failed prop type: The prop `library` is marked as required in `StudioHeaderWrapperBase`, but its value is `null`.
at StudioHeaderWrapperBase (webpack-internal:///./src/library-authoring/studio-header-wrapper/StudioHeaderWrapper.jsx:53:7)
at ShimmedIntlComponent (webpack-internal:///./node_modules/@edx/frontend-platform/i18n/injectIntlWithShim.js:151:7)
at injectIntl(ShimmedIntlComponent)
at ConnectFunction (webpack-internal:///./node_modules/react-redux/es/components/connectAdvanced.js:233:68)
at RenderedRoute (webpack-internal:///./node_modules/react-router/dist/index.js:554:5)
at Routes (webpack-internal:///./node_modules/react-router/dist/index.js:1185:5)
at Router (webpack-internal:///./node_modules/react-router/dist/index.js:1123:15)
at BrowserRouter (webpack-internal:///./node_modules/react-router-dom/dist/index.js:399:5)
at Provider (webpack-internal:///./node_modules/react-redux/es/components/Provider.js:18:20)
at OptionalReduxProvider (webpack-internal:///./node_modules/@edx/frontend-platform/react/OptionalReduxProvider.js:18:20)
at ErrorBoundary (webpack-internal:///./node_modules/@edx/frontend-platform/react/ErrorBoundary.js:139:5)
at IntlProvider (webpack-internal:///./node_modules/react-intl/lib/src/components/provider.js:92:47)
at AppProvider (webpack-internal:///./node_modules/@edx/frontend-platform/react/AppProvider.js:108:20)
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.
Okay, so that is a warning, and if I hardcode the path for LibraryListPage to be "library-authoring", it does render–even though that warning still spills out in the console.
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'm not sure. It just seems very odd that react-router would overwrite that instead of appending.
Based on the change in how links are handled I thought it might be in https://github.com/openedx/frontend-app-library-authoring/blob/master/src/library-authoring/utils/hoc.jsx but nothing there stood out to me.
Maybe @arbrandes has some insight?
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 don't, but perhaps @Syed-Ali-Abbas-Zaidi has sufficient context. The router-v6 changes were pretty extensive!
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.
That they were! To add context, I was specifically looking into why the link Dave mentioned was behaving differently after changing from
goToCreateLibraryPage = () => {
this.props.history.push(ROUTES.List.CREATE);
};
to
goToCreateLibraryPage = () => {
this.props.navigate(ROUTES.List.CREATE);
};
which is what got me looking into hoc.jsx
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.
Questions:
Did you restart/rebuild after making the changes?
Just to confirm, we never tested the problem as fixed on your local tutor?
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 restart/rebuild between changes. Going back to the commit before the react-router upgrade (so commit 16414ff) works. Grabbing the latest master fails. Grabbing this branch also fails in the same way master is failing.
@@ -52,7 +52,7 @@ subscribe(APP_READY, () => { | |||
<Route path={ROUTES.Detail.EDIT} element={<LibraryEditPage />} /> | |||
<Route path={ROUTES.Detail.ACCESS} element={<LibraryAccessPage />} /> | |||
<Route path={ROUTES.Detail.IMPORT} element={<CourseImportPage />} /> | |||
<Route path={`${ROUTES.Block.HOME}/*`} element={<LibraryBlockPage />} /> | |||
<Route path={`${ROUTES.Block.HOME}`} element={<LibraryBlockPage />} /> |
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.
<Route path={`${ROUTES.Block.HOME}`} element={<LibraryBlockPage />} /> | |
<Route path={ROUTES.Block.HOME} element={<LibraryBlockPage />} /> |
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.
Fair. Going to wait for Dave's test then I'll put up an amended version.
@@ -52,7 +52,7 @@ subscribe(APP_READY, () => { | |||
<Route path={ROUTES.Detail.EDIT} element={<LibraryEditPage />} /> | |||
<Route path={ROUTES.Detail.ACCESS} element={<LibraryAccessPage />} /> | |||
<Route path={ROUTES.Detail.IMPORT} element={<CourseImportPage />} /> | |||
<Route path={`${ROUTES.Block.HOME}/*`} element={<LibraryBlockPage />} /> |
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.
@kdmccormick: I lost track of this when openedx/frontend-platform#574 seemed to make things work on tutor. But I'm wondering if this could be the cause of the component edit page still being broken on Tutor dev?
Co-authored-by: Brian Smith <[email protected]>
@connorhaugh Gentle reminder. |
@ormsbee @connorhaugh is this PR still needed? openedx/frontend-platform#574 was merged which made it into https://github.com/openedx/frontend-platform/releases/tag/v5.5.1 and the |
Closing per #439 |
In f62d0aa
we upgraded react router. That change also added the following
became
That broke tutor, as tutor uses /<MFE_TYPE>/.
We know this fix works on tutor and devstack. We want to ensure, however, @Syed-Ali-Abbas-Zaidi that this change was not made for a reason, as we don't want to break an unexpected feature. Can you tell us why you made that change Syed?