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

Validate have settings change alignment #8927

Merged

Conversation

zutigrm
Copy link
Collaborator

@zutigrm zutigrm commented Jun 24, 2024

Summary

Addresses issue:

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 5.2 and PHP 7.4.
  • 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.

Copy link

github-actions bot commented Jun 24, 2024

Build files for 689cae9 have been deleted.

Copy link

github-actions bot commented Jun 24, 2024

Size Change: -152 B (-0.01%)

Total Size: 1.55 MB

Filename Size Change
./dist/assets/js/googlesitekit-activation-********************.js 24 kB -2 B (-0.01%)
./dist/assets/js/googlesitekit-adminbar-********************.js 34.7 kB +5 B (+0.01%)
./dist/assets/js/googlesitekit-data-********************.js 2.37 kB -1 B (-0.04%)
./dist/assets/js/googlesitekit-datastore-forms-********************.js 9.14 kB +1 B (+0.01%)
./dist/assets/js/googlesitekit-datastore-site-********************.js 19.9 kB -6 B (-0.03%)
./dist/assets/js/googlesitekit-datastore-ui-********************.js 10.1 kB +1 B (+0.01%)
./dist/assets/js/googlesitekit-datastore-user-********************.js 25.2 kB +20 B (+0.08%)
./dist/assets/js/googlesitekit-entity-dashboard-********************.js 73.9 kB +6 B (+0.01%)
./dist/assets/js/googlesitekit-main-dashboard-********************.js 123 kB +9 B (+0.01%)
./dist/assets/js/googlesitekit-modules-********************.js 22.2 kB -11 B (-0.05%)
./dist/assets/js/googlesitekit-modules-ads-********************.js 29.6 kB +14 B (+0.05%)
./dist/assets/js/googlesitekit-modules-adsense-********************.js 113 kB -93 B (-0.08%)
./dist/assets/js/googlesitekit-modules-analytics-4-********************.js 142 kB -21 B (-0.01%)
./dist/assets/js/googlesitekit-modules-search-console-********************.js 58.4 kB -104 B (-0.18%)
./dist/assets/js/googlesitekit-modules-tagmanager-********************.js 32.1 kB +16 B (+0.05%)
./dist/assets/js/googlesitekit-settings-********************.js 61.6 kB +2 B (0%)
./dist/assets/js/googlesitekit-splash-********************.js 72.4 kB +9 B (+0.01%)
./dist/assets/js/googlesitekit-user-input-********************.js 48.2 kB +9 B (+0.02%)
./dist/assets/js/googlesitekit-vendor-********************.js 317 kB -1 B (0%)
./dist/assets/js/googlesitekit-widgets-********************.js 59.9 kB -4 B (-0.01%)
./dist/assets/js/googlesitekit-wp-dashboard-********************.js 61.5 kB -1 B (0%)
ℹ️ View Unchanged
Filename Size
./dist/assets/css/googlesitekit-admin-css-********************.min.css 55 kB
./dist/assets/css/googlesitekit-adminbar-css-********************.min.css 11.2 kB
./dist/assets/css/googlesitekit-authorize-application-css-********************.min.css 770 B
./dist/assets/css/googlesitekit-wp-dashboard-css-********************.min.css 7.47 kB
./dist/assets/js/29-********************.js 2.76 kB
./dist/assets/js/30-********************.js 2.25 kB
./dist/assets/js/31-********************.js 3.64 kB
./dist/assets/js/32-********************.js 935 B
./dist/assets/js/33-********************.js 892 B
./dist/assets/js/34-********************.js 3.11 kB
./dist/assets/js/analytics-advanced-tracking-********************.js 776 B
./dist/assets/js/contact-form-7-********************.js 645 B
./dist/assets/js/easy-digital-downloads-********************.js 615 B
./dist/assets/js/googlesitekit-ad-blocking-recovery-********************.js 59.4 kB
./dist/assets/js/googlesitekit-api-********************.js 10.2 kB
./dist/assets/js/googlesitekit-components-gm2-********************.js 5.89 kB
./dist/assets/js/googlesitekit-components-gm3-********************.js 10.1 kB
./dist/assets/js/googlesitekit-datastore-location-********************.js 2.08 kB
./dist/assets/js/googlesitekit-i18n-********************.js 3.92 kB
./dist/assets/js/googlesitekit-modules-pagespeed-insights-********************.js 22.6 kB
./dist/assets/js/googlesitekit-polyfills-********************.js 377 B
./dist/assets/js/mailchimp-********************.js 629 B
./dist/assets/js/ninja-forms-********************.js 727 B
./dist/assets/js/optin-monster-********************.js 673 B
./dist/assets/js/popup-maker-********************.js 634 B
./dist/assets/js/runtime-********************.js 1.3 kB
./dist/assets/js/woocommerce-********************.js 652 B
./dist/assets/js/wpforms-********************.js 632 B

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 good, but let's add a few extra tests and restore the removed documentation for the safe selector.

Comment on lines -281 to -294
/**
* Indicates whether the current settings have changed from what is saved.
*
* @since 1.6.0
* @since 1.77.0 Added ability to filter settings using `keys` argument.
* @since 1.129.0 Changed the approach to use validateHaveSettingsChanged callback.
*
* @param {Object} state Data store's state.
* @param {Array|null} keys Settings keys to check; if not provided, all settings are checked.
* @return {boolean} True if the settings have changed, false otherwise.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the doc string for the selector? Let's keep it around (and update its documentation if needed, I'd think it would be since it's changed a bit now).

Copy link
Collaborator Author

@zutigrm zutigrm Jun 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it since we don't have inline docs in other places for this kind of selectors, but yeah you are right, it makes more sense to keep it since we already have it

expect( validateHaveSettingsChanged ).toHaveBeenCalled();
} );
} );

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add tests to ensure the "safe" selector (haveSettingsChanged) never throws an exception when __dangerousHaveSettingsChanged would throw.

@zutigrm
Copy link
Collaborator Author

zutigrm commented Jun 26, 2024

@tofumatt Thanks, PR updated

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.

Awesome, thanks 👍🏻

@tofumatt tofumatt merged commit 8240ccf into develop Jun 27, 2024
21 checks passed
@tofumatt tofumatt deleted the enhancement/8904-validate-have-settings-change-alignment branch June 27, 2024 16:34
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