-
Notifications
You must be signed in to change notification settings - Fork 377
fix(nav): Fix bug where previous was expanding on select #1479
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
Conversation
66702d7 to
d6e7026
Compare
|
PatternFly-React preview: https://1479-pr-patternfly-react-patternfly.surge.sh |
Codecov Report
@@ Coverage Diff @@
## master #1479 +/- ##
=======================================
Coverage 83.41% 83.41%
=======================================
Files 543 543
Lines 5619 5619
Branches 12 12
=======================================
Hits 4687 4687
Misses 930 930
Partials 2 2
Continue to review full report at Codecov.
|
d6e7026 to
c0be726
Compare
| componentWillReceiveProps(nextProps) { | ||
| if (nextProps.defaultValue !== this.state.value) { | ||
| this.setState({ value: nextProps.defaultValue }); | ||
| componentDidUpdate(prevProps) { |
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.
👍
c0be726 to
900422d
Compare
900422d to
8e770a2
Compare
packages/patternfly-4/react-core/src/components/Nav/NavToggle.js
Outdated
Show resolved
Hide resolved
8e770a2 to
f92a086
Compare
tlabaj
left a comment
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.
LGTM
|
This fix introduces some new bugs:
cc: @spadgett, @janwright73, @priley86 |
|
It seems like the underlying problem is that we're tracking the same value using both props and state, which is generally considered an anti-pattern. Would it be simpler just to let the outer component control expanded state and add a callback for when the nav section is activated? Then the expanded prop is the single source of truth. It puts more work on the outer component, but I don't see a good way around that as long as the expanded state can change based on things that happen outside the nav (such as the user clicking on a link on a details page). |
|
this should mostly be resolved now. One step closer here... |



What:
#1016
Additional issues: