-
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
Selectors: Add areAllSitesSingleUser #13123
Conversation
bcd72ba
to
8f81602
Compare
* @param {Object} state Global state tree | ||
* @return {Boolean} True if all sites are single user sites | ||
*/ | ||
export default function areAllSitesSingleUser( state ) { |
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.
Might be worth memoizing with createSelector
*/ | ||
export default function areAllSitesSingleUser( state ) { | ||
const siteIds = Object.keys( state.sites.items ); | ||
return siteIds && siteIds.every( ( siteId ) => isSingleUserSite( state, siteId ) ); |
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 believe an empty array will be true here
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.
Good to 🚢 after you verify if that's the desired behavior for initial state.
AFAICS, this is only used by the post editor to route to |
61d8aa8
to
2e7f87a
Compare
Returns true if every site of the current user is a single user site.
Needed for #13121 and #13094.
Not used in code yet.