Invites: Fix JS error caused from polling sites #5273
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Today, I noticed that a JS error was occurring for logged out invites.
To reproduce:
/people/new/$site
where$site
is a WP.com siteAfter digging in, it looks like the error was coming from this line:
https://github.com/Automattic/wp-calypso/blob/master/client/layout/index.jsx#L62
Specifically, trying to add a poller to
this.props.sites
even when the user is logged out. To fix this, I simply removed theaccept-invite
path from thesites
group.I tested accepting invites afterward, and it worked. But frankly, I'm not sure if this will cause issues with chunking or anything else. I did notice several other sections did not have groups set, so my guess is no. All the same, pining @mtias who has a better idea.
To test:
fix/invites-poller-js-error
branch/people/new/$site
where$site
is a WP.com sitewordpress.com
withcalypso.localhost:3000
Error on production:
No error with this branch in development:
cc @lezama for code review.