-
Notifications
You must be signed in to change notification settings - Fork 5
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
fix: [useCollapse] cleanup resize observer, overflow css #1577
Conversation
8edfac7
to
fdc9bc3
Compare
Codecov Report
@@ Coverage Diff @@
## master #1577 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 96 96
Lines 1695 1706 +11
Branches 471 478 +7
=========================================
+ Hits 1695 1706 +11
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
fdc9bc3
to
ba4a095
Compare
src/hooks/useCollapse.js
Outdated
React.useEffect(() => { | ||
setCollapsed(collapsedProp); | ||
}, [collapsedProp]); |
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.
guess this is because both collapsedProp
and toggleCollapsed
are trying control collapsed
state
i think should be either
(defaultCollapsed, ...) => {collapsed, toggleCollapsed, ...}
or
(colleapsed, ...) => {...}
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.
yes, defaultCollapsed is better
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.
then i guess this can be removed as default props shouldn't be affecting the element state during its life cycle, the same as defaultValue
to input
component
adslot-ui/src/hooks/useCollapse.js
Lines 53 to 55 in 28fcf38
React.useEffect(() => { | |
setCollapsed(defaultCollapsed); | |
}, [defaultCollapsed]); |
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.
oh, it's still being used to control the component, so I think I'll revert the naming to what it was before
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.
what i mean was both toggleCollapsed
and collapsedProp
control the collapse
state, should be just keeping one.
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 see what you mean, I'll remove the toggleCollapsed
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.
@knilink removed internal collapsed state and toggle function
91da30c
to
7ad4973
Compare
7ad4973
to
38345fd
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Description
requestAnimationFrame
so we don't get theLoop limit exceeded
error.useCollapse
, so we can hide overflow only when animatingDoes this PR introduce a breaking change?
Manual testing step?
Screenshots (if appropriate):
no overflow / without fix
with overflow/display transition classes