Skip to content
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

Merged
merged 4 commits into from
May 29, 2017

Conversation

mcsf
Copy link
Member

@mcsf mcsf commented May 13, 2017

Part of #14024

Testing

SitesDropdown is used in SiteSelectorModal (via ellipsis actions at /themes), /me/account, HelpContactForm. Behaviors should remain unchanged.

@mcsf mcsf added Framework Sites [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels May 13, 2017
@mcsf mcsf self-assigned this May 13, 2017
@mcsf mcsf requested review from ockham, mtias, gwwar and tyxla May 13, 2017 22:25
@matticbot matticbot added the [Size] L Large sized issue label May 13, 2017
@matticbot
Copy link
Contributor

@mcsf mcsf force-pushed the remove/sites-dropdown-selector-state-binding branch from da7594a to 220b1ad Compare May 14, 2017 21:00

componentDidMount() {
const { initialSiteId, setSelectedSiteSlug } = this.props;
setSelectedSiteSlug( initialSiteId );
Copy link
Member

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 ❓

Copy link
Member Author

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. :)

Copy link
Member Author

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.

@mcsf mcsf force-pushed the remove/sites-dropdown-selector-state-binding branch from 5d5a009 to 4cf2ada Compare May 16, 2017 18:10
Copy link
Member

@tyxla tyxla left a 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 👍

mcsf added 4 commits May 26, 2017 12:53
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.
@mcsf mcsf force-pushed the remove/sites-dropdown-selector-state-binding branch from 4cf2ada to 578e1e8 Compare May 26, 2017 13:25
@mcsf
Copy link
Member Author

mcsf commented May 26, 2017

Rebased against master.

@mcsf mcsf merged commit df2b7a6 into master May 29, 2017
@mcsf mcsf deleted the remove/sites-dropdown-selector-state-binding branch May 29, 2017 15:42
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label May 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants