Skip to content

Enhancement/11296 enhance use form value#12648

Merged
aaemnnosttv merged 6 commits into
developfrom
enhancement/11296-enhance-use-form-value
May 12, 2026
Merged

Enhancement/11296 enhance use form value#12648
aaemnnosttv merged 6 commits into
developfrom
enhancement/11296-enhance-use-form-value

Conversation

@abdelmalekkkkk

@abdelmalekkkkk abdelmalekkkkk commented May 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Addresses issue:

Relevant technical choices

Slight deviation from IB: did not add a new action setValue since the existing setValues could be used just fine.

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.
  • Ensure there are no unexpected significant changes to file sizes.

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

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown

🤖 This comment is automatically updated by CI workflows. Each section is managed independently.

📚 Storybook for ccef63b:

  • Storybook has been deleted.

📦 Build files for ccef63b:

  • Build files have been deleted.

🎭 Playwright reports for ccef63b:

  • Reports have been deleted.

@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 2.3 MB

ℹ️ View Unchanged
Filename Size Change
dist/assets/blocks/reader-revenue-manager/block-editor-plugin/editor-styles.css 124 B 0 B
dist/assets/blocks/reader-revenue-manager/block-editor-plugin/editor-styles.js 0 B 0 B 🆕
dist/assets/blocks/reader-revenue-manager/block-editor-plugin/index.js 42.7 kB 0 B
dist/assets/blocks/reader-revenue-manager/common/editor-styles.css 307 B 0 B
dist/assets/blocks/reader-revenue-manager/common/editor-styles.js 0 B 0 B 🆕
dist/assets/blocks/reader-revenue-manager/contribute-with-google/index.js 5.81 kB 0 B
dist/assets/blocks/reader-revenue-manager/contribute-with-google/non-site-kit-user.js 5 kB 0 B
dist/assets/blocks/reader-revenue-manager/subscribe-with-google/index.js 5.81 kB 0 B
dist/assets/blocks/reader-revenue-manager/subscribe-with-google/non-site-kit-user.js 5 kB 0 B
dist/assets/blocks/sign-in-with-google/editor-styles.css 84 B 0 B
dist/assets/blocks/sign-in-with-google/editor-styles.js 0 B 0 B 🆕
dist/assets/blocks/sign-in-with-google/index.js 18.5 kB 0 B
dist/assets/css/googlesitekit-admin-css-********************.min.css 68.7 kB 0 B
dist/assets/css/googlesitekit-adminbar-css-********************.min.css 12.3 kB 0 B
dist/assets/css/googlesitekit-authorize-application-css-********************.min.css 851 B 0 B
dist/assets/css/googlesitekit-wp-dashboard-css-********************.min.css 8.88 kB 0 B
dist/assets/js/146-********************.js 960 B 0 B
dist/assets/js/201-********************.js 2.85 kB 0 B
dist/assets/js/314-********************.js 100 kB 0 B
dist/assets/js/315-********************.js 3.08 kB 0 B
dist/assets/js/379-********************.js 3.7 kB 0 B
dist/assets/js/590-********************.js 1.88 kB 0 B
dist/assets/js/640-********************.js 2.35 kB 0 B
dist/assets/js/909-********************.js 1.01 kB 0 B
dist/assets/js/analytics-advanced-tracking-********************.js 404 B 0 B
dist/assets/js/googlesitekit-activation-********************.js 24.9 kB 0 B
dist/assets/js/googlesitekit-ad-blocking-recovery-********************.js 60 kB +47 B (+0.08%)
dist/assets/js/googlesitekit-admin-pointers-tracking-********************.js 5.36 kB 0 B
dist/assets/js/googlesitekit-adminbar-********************.js 36 kB 0 B
dist/assets/js/googlesitekit-api-********************.js 8.04 kB 0 B
dist/assets/js/googlesitekit-block-tracking-********************.js 5.56 kB 0 B
dist/assets/js/googlesitekit-components-********************.js 5.63 kB 0 B
dist/assets/js/googlesitekit-consent-mode-********************.js 25.5 kB 0 B
dist/assets/js/googlesitekit-data-********************.js 1.76 kB 0 B
dist/assets/js/googlesitekit-datastore-forms-********************.js 7.21 kB 0 B
dist/assets/js/googlesitekit-datastore-location-********************.js 1.52 kB 0 B
dist/assets/js/googlesitekit-datastore-site-********************.js 18.7 kB 0 B
dist/assets/js/googlesitekit-datastore-ui-********************.js 7.37 kB 0 B
dist/assets/js/googlesitekit-datastore-user-********************.js 23.1 kB 0 B
dist/assets/js/googlesitekit-entity-dashboard-********************.js 73.3 kB +42 B (+0.06%)
dist/assets/js/googlesitekit-events-provider-contact-form-7-********************.js 1.23 kB 0 B
dist/assets/js/googlesitekit-events-provider-easy-digital-downloads-********************.js 629 B 0 B
dist/assets/js/googlesitekit-events-provider-mailchimp-********************.js 1.22 kB 0 B
dist/assets/js/googlesitekit-events-provider-ninja-forms-********************.js 1.22 kB 0 B
dist/assets/js/googlesitekit-events-provider-optin-monster-********************.js 1.25 kB 0 B
dist/assets/js/googlesitekit-events-provider-popup-maker-********************.js 1.29 kB 0 B
dist/assets/js/googlesitekit-events-provider-woocommerce-********************.js 918 B 0 B
dist/assets/js/googlesitekit-events-provider-wpforms-********************.js 1.25 kB 0 B
dist/assets/js/googlesitekit-i18n-********************.js 6.1 kB 0 B
dist/assets/js/googlesitekit-key-metrics-setup-********************.js 53.4 kB +41 B (+0.08%)
dist/assets/js/googlesitekit-main-dashboard-********************.js 158 kB -42 B (-0.03%)
dist/assets/js/googlesitekit-metric-selection-********************.js 59.2 kB +4 B (+0.01%)
dist/assets/js/googlesitekit-modules-********************.js 26 kB 0 B
dist/assets/js/googlesitekit-modules-ads-********************.js 47.9 kB 0 B
dist/assets/js/googlesitekit-modules-adsense-********************.js 136 kB -104 B (-0.08%)
dist/assets/js/googlesitekit-modules-analytics-4-********************.js 188 kB -98 B (-0.05%)
dist/assets/js/googlesitekit-modules-pagespeed-insights-********************.js 23.3 kB 0 B
dist/assets/js/googlesitekit-modules-reader-revenue-manager-********************.js 52.6 kB +30 B (+0.06%)
dist/assets/js/googlesitekit-modules-search-console-********************.js 65.3 kB +29 B (+0.04%)
dist/assets/js/googlesitekit-modules-sign-in-with-google-********************.js 33.8 kB 0 B
dist/assets/js/googlesitekit-modules-tagmanager-********************.js 30.1 kB +13 B (+0.04%)
dist/assets/js/googlesitekit-notifications-********************.js 66.7 kB +49 B (+0.07%)
dist/assets/js/googlesitekit-polyfills-********************.js 228 B 0 B
dist/assets/js/googlesitekit-settings-********************.js 135 kB -20 B (-0.01%)
dist/assets/js/googlesitekit-splash-********************.js 79.1 kB +11 B (+0.01%)
dist/assets/js/googlesitekit-user-input-********************.js 51.6 kB +32 B (+0.06%)
dist/assets/js/googlesitekit-vendor-********************.js 315 kB 0 B
dist/assets/js/googlesitekit-widgets-********************.js 104 kB -52 B (-0.05%)
dist/assets/js/googlesitekit-wp-dashboard-********************.js 61 kB -31 B (-0.05%)
dist/assets/js/runtime-********************.js 1.86 kB 0 B

compressed-size-action

@abdelmalekkkkk abdelmalekkkkk force-pushed the enhancement/11296-enhance-use-form-value branch from 0fd5e96 to 2e6b53b Compare May 5, 2026 13:20
@aaemnnosttv

Copy link
Copy Markdown
Collaborator

@abdelmalekkkkk please address the merge conflict here, thanks.

@aaemnnosttv aaemnnosttv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @abdelmalekkkkk, this looks great. Besides the merge conflict there are just a few points I've noted for your review.


const resetUnstagedSelection = useCallback( () => {
setValues( KEY_METRICS_SELECTION_FORM, {
[ KEY_METRICS_SELECTED ]: selectedMetrics,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[ KEY_METRICS_SELECTED ] is not set in the refactored version

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It was setting KEY_METRICS_SELECTED to its current value selectedMetrics, which looks unnecessary, unless I'm missing something?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

That makes sense, just highlighting as a potential oversight.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

After taking a closer look, let's double check this since this is also updated with another value currentlySelectedMetrics in other places so it may be intentional after all.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I double checked and it still seems unnecessary. The one in assets/js/components/KeyMetrics/MetricsSelectionPanel/MetricItem.js (which I think is what you referred to) makes sense because it updates KEY_METRICS_SELECTED based on which checkbox was toggled, either appending to or removing from the existing selected metrics array.

Comment on lines -123 to -126
setValues( AUDIENCE_TILE_CUSTOM_DIMENSION_CREATE, {
autoSubmit: false,
isRetrying: false,
} );

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This happens in a few places, but anywhere we're splitting a single state change into two state changes, there is the possibility of something breaking in the intermediate state (e.g. autoSubmit is false, but isRetrying is still true. This is because each state change will trigger a render. React batches updates, so that is less of an issue – we just need to make sure it doesn't introduce a problem where none was before.

In most places we're only dealing with a single key in the form state, but if needed, we can also keep the previous form for these scenarios. Another somewhat more complicated option would be to wrap the multiple calls with registry.batch.

We don't need to reach for this now but just mentioning the options we have in case the refactor is problematic in any of these places.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I considered that while doing the refactor but figured it would probably not be a problem.

I actually came across one instance where splitting the state update caused a test to fail, which was the setValues in assets/js/modules/analytics-4/components/audience-segmentation/dashboard/AudienceSelectionPanel/Panel.js. The actual UI seemed to work fine but a couple of tests failed. I just let that setValues as it is since debugging those tests seemed like it would take a lot more time.

@abdelmalekkkkk abdelmalekkkkk force-pushed the enhancement/11296-enhance-use-form-value branch from 07370ab to b3c9535 Compare May 8, 2026 21:05
@abdelmalekkkkk

Copy link
Copy Markdown
Contributor Author

Thanks @aaemnnosttv. I resolved the merge conflicts and replied to your comments. Please take another look.

@aaemnnosttv aaemnnosttv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @abdelmalekkkkk – one thing to double check otherwise this LGTM

See #12648 (comment)

@abdelmalekkkkk abdelmalekkkkk force-pushed the enhancement/11296-enhance-use-form-value branch from b3c9535 to 3fbbe3a Compare May 12, 2026 14:41
@abdelmalekkkkk

Copy link
Copy Markdown
Contributor Author

Thanks @aaemnnosttv. I did a double check and it still looks fine to me. I fixed the position of one comment that I misplaced during the refactor. The merge conflict is also resolved.

@aaemnnosttv aaemnnosttv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great, thanks @abdelmalekkkkk !

@aaemnnosttv aaemnnosttv merged commit 8b580ae into develop May 12, 2026
31 of 32 checks passed
@aaemnnosttv aaemnnosttv deleted the enhancement/11296-enhance-use-form-value branch May 12, 2026 20:22
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