Skip to content

@W-18910688 - refactored error utils#2781

Merged
kzheng-sfdc merged 3 commits intofeature/chakra-ui-upgrade-v3from
u/kzheng/W-18910688/refactored-error-utils
Jul 10, 2025
Merged

@W-18910688 - refactored error utils#2781
kzheng-sfdc merged 3 commits intofeature/chakra-ui-upgrade-v3from
u/kzheng/W-18910688/refactored-error-utils

Conversation

@kzheng-sfdc
Copy link
Contributor

Description

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

Renamed generic cart/utils/cart-utils -> utils/error-utils, then consolidated 6 duplicate code occurrences to use the util.

How to Test-Drive This PR

Run all jest tests.
Generate a new app and verify all the modified pages are working as expected.

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@kzheng-sfdc kzheng-sfdc requested a review from a team as a code owner July 10, 2025 20:55
@kzheng-sfdc kzheng-sfdc added the skip changelog Skip the "Changelog Check" GitHub Actions step even if the Changelog.md files are not updated label Jul 10, 2025
@cc-prodsec
Copy link
Collaborator

cc-prodsec commented Jul 10, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

const showError = !isProductASet && !isProductABundle && !hasValidSelection
const scrollToError = showError && scrollErrorIntoView
const hasError = !isProductASet && !isProductABundle && !hasValidSelection
const scrollToError = hasError && scrollErrorIntoView
Copy link
Contributor Author

Choose a reason for hiding this comment

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

rename the local scoped "showError" to "hasError" to avoid confusion.

@kzheng-sfdc kzheng-sfdc requested a review from kevinxh July 10, 2025 21:00
* @returns {Function} showError function
*/
export const useCartErrorHandler = () => {
export const useErrorHandler = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be in hooks folder. Utils is for generic function that is not React related.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@kzheng-sfdc kzheng-sfdc requested a review from alexvuong July 10, 2025 21:56
Copy link
Contributor

@kevinxh kevinxh 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 shipping small diffs to make the codebase better!

@kzheng-sfdc kzheng-sfdc merged commit 4b74eb2 into feature/chakra-ui-upgrade-v3 Jul 10, 2025
33 checks passed
alexvuong pushed a commit that referenced this pull request Jul 16, 2025
…0688/refactored-error-utils

@W-18910688 - refactored error utils
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip changelog Skip the "Changelog Check" GitHub Actions step even if the Changelog.md files are not updated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants