-
Notifications
You must be signed in to change notification settings - Fork 293
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
Enhance/4819 auth dependent components #5078
Conversation
Size Change: +866 B (0%) Total Size: 1.36 MB
ℹ️ View Unchanged
|
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.
Looks great, but can you add a QA Brief to the issue?
(I cleaned up that JSDoc error I mentioned so all this needs is a QA Brief and it's good.)
confirmIfSkipModal(); | ||
}, [ onConfirm, permissionsError ] ); | ||
|
||
if ( ! permissionsError ) { |
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 looks like this can potentially return undefined
, which I was assuming is from it resolving and returning undefined
during that, but it appears that actually isn't the case… it's either null
or an error.
But the docs say it can return undefined
:
site-kit-wp/assets/js/googlesitekit/datastore/user/permissions.js
Lines 147 to 159 in d3aed2e
/** | |
* Gets the most recent permission error encountered by this user. | |
* | |
* @since 1.9.0 | |
* @private | |
* | |
* @param {Object} state Data store's state. | |
* @return {(Object|undefined)} Permission scope errors. Returns `null` if no error exists. | |
*/ | |
getPermissionScopeError( state ) { | |
const { permissionError } = state; | |
return permissionError; | |
}, |
This isn't related to your change, but we should update the JSDoc for getPermissionScopeError
so it doesn't trip anyone else up. Looks like it should be @return {(Object|undefined)}
not @return {(Object|null)}
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.
Worse: I think it was me who wrong that JSDoc. Shame! 😆
Summary
Addresses issue:
Relevant technical choices
I had to divert a bit away from the IB to make sure
PermissionModal
doesn't render for non authenticated users. As we can't really use selectors in theRoot
component, I created a Inner Component and extracted everything from thePermissionModal
to the new one. That way we can check the user authentication status inside the now mostly empty and wrapperPermissionMolal
and return inner component or null accordingly. See the comments on the original issue for discussion and thanks @aaemnnosttv for the suggestion!PR Author Checklist
Do not alter or remove anything below. The following sections will be managed by moderators only.
Code Reviewer Checklist
Merge Reviewer Checklist