fix: showUserDropdown hiding LearningHeaderActionsSlot#676
Conversation
The showUserDropdown prop gates both the LearningHeaderActionsSlot and the AuthenticatedUserDropdown. This makes it impossible to just hide the userDropdown without also hiding all the action items like the help menu and the notifications. This commit applies the `showUserDropdown` gate to just the user dropdown menu. Ref: openedx#675
|
Thanks for the pull request, @tecoholic! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #676 +/- ##
==========================================
+ Coverage 73.07% 73.18% +0.10%
==========================================
Files 60 60
Lines 520 522 +2
Branches 110 112 +2
==========================================
+ Hits 380 382 +2
Misses 137 137
Partials 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
xitij2000
left a comment
There was a problem hiding this comment.
This change generally makes sense to me since it allows using the slot even if showUserDropdown is false. However, my concern is that this changes the nature of the slot.
My recommendation would be making a v2 version of this slot that wraps the v1 version of the slot. So the v2 version of the slot can be rendered in all situations, and get showUserDropdown as a prop. The v2 slot can conditionally render the v1 slot when showUserDropdown and authenticatedUser are truthy. This keeps backwards compatibility while also allowing our use case.
CC: @brian-smith-tcril I'd love your input for how to handle cases like these. Does my suggestion above make sense or is it overkill in this case?
Do you mean, it changes the current nature of the slot? Because it doesn't change the "nature of the slot" - it still renders action items. I think the current behavior is bugged. However, I can see the merit of using a V2 to document the change in behavior. Let's see what @brian-smith-tcril thinks as well. |
What I mean to say is that it goes from being a conditional slot to a permanent slot. Plugins might be relying on the fact that this slot is rendered conditionally, and they will need to change their code. |
|
Multiple things going on here:
With that in mind, the change in this PR would be breaking the existing slot API contract and should not land as-is. If we want to continue gating both - const LearningHeaderActionsSlot = () => (
+ const LearningHeaderActionsSlot = (showUserDropdown) => (
<PluginSlot
- id="org.openedx.frontend.layout.learning_header_actions.v1"
+ id="org.openedx.frontend.layout.learning_header_actions.v2"
>
+ {showUserDropdown && (
+ <PluginSlot
+ id="org.openedx.frontend.layout.learning_header_actions.v1"
+ >
<HeaderNotificationsSlot />
<LearningHelpSlot />
+ </PluginSlot>
+ )}
</PluginSlot>
);I do want to consider if gating behind I would also recommend putting out a DEPR for the |
Description
The showUserDropdown prop gates both the LearningHeaderActionsSlot and the AuthenticatedUserDropdown. This makes it impossible to just hide the userDropdown without also hiding all the action items like the help menu and the notifications.
This commit applies the
showUserDropdowngate to just the user dropdown menu.Reference
#675
Before
After
Testing instructions
Important
Before starting, ensure you have a Tutor environment with the Learning MFE in development mode running.
npm ci && npm run buildnpm install "../path/to/this/repo" --legacy-peer-depsfrontend-app-learning/env.config.jsxfrontend-app-learning/module.config.jsfrontend-component-headerrepo and switch to this PR's branch.npm run build(a couple of times for luck, I found webpack missing references as it live reloads)