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

fix: Update defaultParcelSize only when it exists #295

Merged
merged 1 commit into from
Jul 16, 2020

Conversation

Manizuca
Copy link
Contributor

Signed-off-by: Matias Zuniga [email protected]

Resolves reactioncommerce/reaction#6257
Impact: minor
Type: bugfix

Issue

On a clean install, the Base of Unit Measure or Base Unit of Length cannot be changed unless the Default Parcel Size value is set.
This happens because the code tries to update defaultParcelSize, even if it doesn't exist, throwing TypeError: Cannot read property 'weight' of null when trying to calculate the new defaultParcelSize.

Solution

Check for the existence of defaultParcelSize before trying to calculate an updated value.

Testing

  1. Start a fresh setup with this PR applied.
  2. Login as admin user
  3. Try and change Base of Unit Measure or Base Unit of Length
  4. baseUOM or baseUOL was updated without errors.

@Manizuca
Copy link
Contributor Author

The eslint failure is unrelated to this PR

@manueldelreal
Copy link
Member

After #290 is merged the eslint error will go away. I didn't see the error with this one, want to confirm locally as well @willopez ?

@willopez
Copy link
Member

@manueldelreal you correct, that eslint error will go away once #290 is merged.

@willopez
Copy link
Member

@Manizuca Thank you for your contribution. The eslint error will go away if you rebase using the latest upstream trunk.

@willopez
Copy link
Member

Thanks!for fixing this @Manizuca

Copy link
Member

@willopez willopez left a comment

Choose a reason for hiding this comment

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

LGTM

@willopez willopez merged commit 1f617dd into reactioncommerce:trunk Jul 16, 2020
@Manizuca Manizuca deleted the fix-reaction-6257 branch July 18, 2020 17:25
mikoscz pushed a commit to mikoscz/reaction-admin that referenced this pull request Aug 3, 2020
fix: Update defaultParcelSize only when it exists
@kieckhafer kieckhafer mentioned this pull request Aug 4, 2020
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.

Update Shop Localization settings fails if Default Parcel Size is not set
3 participants