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

Enhance/4819 auth dependent components #5078

Merged
merged 7 commits into from
Apr 12, 2022

Conversation

kuasha420
Copy link
Contributor

@kuasha420 kuasha420 commented Apr 12, 2022

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 the Root component, I created a Inner Component and extracted everything from the PermissionModal to the new one. That way we can check the user authentication status inside the now mostly empty and wrapper PermissionMolal 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

  • My code is tested and passes existing unit tests.
  • My code has an appropriate set of unit tests which all pass.
  • My code is backward-compatible with WordPress 4.7 and PHP 5.6.
  • My code follows the WordPress coding standards.
  • My code has proper inline documentation.
  • I have added a QA Brief on the issue linked above.
  • I have signed the Contributor License Agreement (see https://cla.developers.google.com/).

Do not alter or remove anything below. The following sections will be managed by moderators only.

Code Reviewer Checklist

  • Run the code.
  • Ensure the acceptance criteria are satisfied.
  • Reassess the implementation with the IB.
  • Ensure no unrelated changes are included.
  • Ensure CI checks pass.
  • Check Storybook where applicable.
  • Ensure there is a QA Brief.

Merge Reviewer Checklist

  • Ensure the PR has the correct target branch.
  • Double-check that the PR is okay to be merged.
  • Ensure the corresponding issue has a ZenHub release assigned.
  • Add a changelog message to the issue.

@github-actions
Copy link

github-actions bot commented Apr 12, 2022

Size Change: +866 B (0%)

Total Size: 1.36 MB

Filename Size Change
./dist/assets/js/33-********************.js 3.12 kB +1 B (0%)
./dist/assets/js/googlesitekit-activation-********************.js 33.5 kB +44 B (0%)
./dist/assets/js/googlesitekit-adminbar-********************.js 37.4 kB +58 B (0%)
./dist/assets/js/googlesitekit-api-********************.js 9.41 kB -1 B (0%)
./dist/assets/js/googlesitekit-base-********************.js 1.58 kB +1 B (0%)
./dist/assets/js/googlesitekit-dashboard-********************.js 55.8 kB +68 B (0%)
./dist/assets/js/googlesitekit-dashboard-details-********************.js 53.4 kB +75 B (0%)
./dist/assets/js/googlesitekit-dashboard-splash-********************.js 67.2 kB +53 B (0%)
./dist/assets/js/googlesitekit-data-********************.js 2.09 kB -1 B (0%)
./dist/assets/js/googlesitekit-datastore-location-********************.js 2.08 kB -1 B (0%)
./dist/assets/js/googlesitekit-datastore-user-********************.js 22.3 kB -3 B (0%)
./dist/assets/js/googlesitekit-idea-hub-post-list-********************.js 26 kB +43 B (0%)
./dist/assets/js/googlesitekit-module-********************.js 47.7 kB +70 B (0%)
./dist/assets/js/googlesitekit-modules-********************.js 17.3 kB +2 B (0%)
./dist/assets/js/googlesitekit-modules-adsense-********************.js 68.9 kB +78 B (0%)
./dist/assets/js/googlesitekit-modules-analytics-********************.js 74.6 kB +121 B (0%)
./dist/assets/js/googlesitekit-modules-analytics-4-********************.js 19.2 kB +2 B (0%)
./dist/assets/js/googlesitekit-modules-idea-hub-********************.js 35.1 kB -4 B (0%)
./dist/assets/js/googlesitekit-modules-optimize-********************.js 19.4 kB +6 B (0%)
./dist/assets/js/googlesitekit-modules-pagespeed-insights-********************.js 18.8 kB -4 B (0%)
./dist/assets/js/googlesitekit-modules-search-console-********************.js 40.6 kB -7 B (0%)
./dist/assets/js/googlesitekit-modules-subscribe-with-google-********************.js 17.8 kB -4 B (0%)
./dist/assets/js/googlesitekit-polyfills-********************.js 378 B -1 B (0%)
./dist/assets/js/googlesitekit-settings-********************.js 51.7 kB +68 B (0%)
./dist/assets/js/googlesitekit-user-input-********************.js 47.8 kB +58 B (0%)
./dist/assets/js/googlesitekit-vendor-********************.js 318 kB -8 B (0%)
./dist/assets/js/googlesitekit-widgets-********************.js 19.3 kB -3 B (0%)
./dist/assets/js/googlesitekit-wp-dashboard-********************.js 60.8 kB +158 B (0%)
./dist/assets/js/runtime-********************.js 1.21 kB -3 B (0%)
ℹ️ View Unchanged
Filename Size
./dist/assets/css/googlesitekit-admin-css-********************.min.css 42.5 kB
./dist/assets/css/googlesitekit-adminbar-css-********************.min.css 11.3 kB
./dist/assets/css/googlesitekit-wp-dashboard-css-********************.min.css 6.53 kB
./dist/assets/js/32-********************.js 51.9 kB
./dist/assets/js/analytics-advanced-tracking-********************.js 769 B
./dist/assets/js/googlesitekit-datastore-forms-********************.js 9.05 kB
./dist/assets/js/googlesitekit-datastore-site-********************.js 14.7 kB
./dist/assets/js/googlesitekit-datastore-ui-********************.js 9.15 kB
./dist/assets/js/googlesitekit-i18n-********************.js 3.92 kB
./dist/assets/js/googlesitekit-idea-hub-notice-********************.js 4.96 kB
./dist/assets/js/googlesitekit-modules-tagmanager-********************.js 30.8 kB

compressed-size-action

Copy link
Collaborator

@tofumatt tofumatt left a 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 ) {
Copy link
Collaborator

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:

/**
* 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)}

Copy link
Collaborator

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! 😆

@tofumatt tofumatt merged commit 9b5ae6c into develop Apr 12, 2022
@tofumatt tofumatt deleted the enhance/4819-auth-dependent-components branch April 12, 2022 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants