-
Notifications
You must be signed in to change notification settings - Fork 69
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
[BD-46] fix Tabs
not resizing on theme switch
#2962
Conversation
Thanks for the pull request, @viktorrusakov! When this pull request is ready, tag your edX technical lead. |
✅ Deploy Preview for paragon-openedx ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
const containerElementRef = React.useRef(null); | ||
const [containerElementRef, setContainerElementRef] = React.useState(null); |
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.
This is technically a breaking change for consumers, but I don't see any usage of this hook in Usage Insighhts table, so I think it should be okay to release it as a fix.
The reason we need to use callback ref is to trigger a re-render once the ref is attached to the DOM element, previously this re-render was caused by useWindowSize
hook that was used in useIndexOfLastVisibleChild
hook before this PR.
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.
[inform] Yeah, it looks like there aren't any consumers of this hook from Paragon directly, but there are (nearly) duplicate functions that exist within frontend-app-learning (source) and frontend-app-discussions (source). They were likely implemented before we implemented the responsive Tabs
in Paragon.
I agree this should probably be OK to release a fix.
…stead of window resize
21af7ca
to
a734575
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2962 +/- ##
=======================================
Coverage 92.87% 92.88%
=======================================
Files 235 235
Lines 4268 4272 +4
Branches 1033 1033
=======================================
+ Hits 3964 3968 +4
Misses 300 300
Partials 4 4 ☔ View full report in Codecov by Sentry. |
const containerElementRef = React.useRef(null); | ||
const [containerElementRef, setContainerElementRef] = React.useState(null); |
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.
[inform] Yeah, it looks like there aren't any consumers of this hook from Paragon directly, but there are (nearly) duplicate functions that exist within frontend-app-learning (source) and frontend-app-discussions (source). They were likely implemented before we implemented the responsive Tabs
in Paragon.
I agree this should probably be OK to release a fix.
🎉 This PR is included in version 21.12.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 22.0.0-alpha.24 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
Fixes
useIndexOfLastVisibleChild
hook to observer resizing of container element instead of whole window. This allows to correctly renderMore...
tab on theme switch.Deploy Preview
https://deploy-preview-2962--paragon-openedx.netlify.app/components/tabs/
Merge Checklist
example
app?wittjeff
andadamstankiewicz
as reviewers on this PR.Post-merge Checklist