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

Move product editor utils to product editor package #36730

Merged
merged 4 commits into from Feb 23, 2023

Conversation

joshuatf
Copy link
Contributor

@joshuatf joshuatf commented Feb 1, 2023

All Submissions:

Changes proposed in this Pull Request:

Moves all utils used in the new product editing experience to the @woocommerce/product-editor package. Other components and hooks will come in follow-up PRs.

Closes #36719 .

  • This PR is a very minor change/addition and does not require testing instructions (if checked you can ignore/remove the next section).

How to test the changes in this Pull Request:

  1. Navigate to the new product editing experience.
  2. Generally smoke test the product editor and make sure it continues to work as expected

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you created a changelog file for each project being changed, ie pnpm --filter=<project> changelog add?

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

@joshuatf joshuatf requested a review from a team February 1, 2023 21:47
@joshuatf joshuatf self-assigned this Feb 1, 2023
@github-actions github-actions bot added focus: react admin plugin: woocommerce Issues related to the WooCommerce Core plugin. labels Feb 1, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2023

Test Results Summary

Commit SHA: a8e801f

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202611m 0s
E2E Tests189006019513m 45s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

@joelclimbsthings joelclimbsthings requested review from joelclimbsthings and removed request for a team February 21, 2023 19:28
Copy link
Contributor

@joelclimbsthings joelclimbsthings left a comment

Choose a reason for hiding this comment

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

Thanks for getting this done @joshuatf ! Gave the editor a pretty good smoke test, and all works well. I added one minor comment, but it's totally optional, so feel free to :shipit: .

/**
* Utils
*/
export { formatCurrencyDisplayValue } from './utils/format-currency-display-value';
Copy link
Contributor

Choose a reason for hiding this comment

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

Likely subjective, but an alternative here would be to add an index.ts file within the /utils directory to export all utilities, and then potentially just export * from './utils'. Makes it a little smoother to import these utils within the package itself, since you can import all from ../utils.

Copy link
Contributor

@joelclimbsthings joelclimbsthings left a comment

Choose a reason for hiding this comment

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

@joshuatf I also noticed that the original utils (such as getCheckboxTracks) haven't been removed, and they're actually still in use by various fills and such. Were you planning to divide this into a separate PR for some reason?

@joshuatf
Copy link
Contributor Author

Thanks for taking a look at this, @joelclimbsthings! It's been a few weeks since I opened this PR, so I'm not sure why I left the section utils separate, but I went ahead and moved them over.

Also moved the util import/exports to a separate file.

@codecov
Copy link

codecov bot commented Feb 23, 2023

Codecov Report

Merging #36730 (a8e801f) into trunk (f9f6e68) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##             trunk   #36730   +/-   ##
========================================
  Coverage     46.7%    46.7%           
  Complexity   17178    17178           
========================================
  Files          429      429           
  Lines        64779    64779           
========================================
  Hits         30240    30240           
  Misses       34539    34539           

Copy link
Contributor

@joelclimbsthings joelclimbsthings left a comment

Choose a reason for hiding this comment

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

Thanks Josh, changes look good and still tests well. 🚢

@joelclimbsthings joelclimbsthings merged commit 87d79f1 into trunk Feb 23, 2023
@joelclimbsthings joelclimbsthings deleted the update/36719 branch February 23, 2023 17:48
@github-actions github-actions bot added this to the 7.6.0 milestone Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: woocommerce Issues related to the WooCommerce Core plugin.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move product utils to product editor package
2 participants