-
Notifications
You must be signed in to change notification settings - Fork 2k
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
SitesDropdown: Don't bind selectors to state #14026
Conversation
da7594a
to
220b1ad
Compare
|
||
componentDidMount() { | ||
const { initialSiteId, setSelectedSiteSlug } = this.props; | ||
setSelectedSiteSlug( initialSiteId ); |
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.
It feels really odd to pass an ID to something that expects a slug ❓
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.
True; an artifact of the first pass. I should rename to id
. :)
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.
Actually, ID on its own would clash with a prop that is part of SitesDropdown
's public interface, so I'm changing to locallySelectedSiteId
.
5d5a009
to
4cf2ada
Compare
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.
Tests well and code LGTM 👍
This is the explicit way to do it. The mechanism of adding a wrapper that holds the state upstream of `connect` could easily be abstracted into a `connectWithState` function.
4cf2ada
to
578e1e8
Compare
Rebased against |
Part of #14024
Testing
SitesDropdown
is used inSiteSelectorModal
(via ellipsis actions at/themes
),/me/account
,HelpContactForm
. Behaviors should remain unchanged.