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

Review props are not causing unnecessary updates in the component. #314

Merged

Conversation

devbucket
Copy link
Contributor

Description

Since every action in the write-review-form was causing the incoming props to change, one would see previous form state when submitting a changed review. This is now prevented by protecting props from being populated if they are not changed.

Type of change

Please add an "x" into the option that is relevant:

  • [ x ] Bug Fix 🐛 (non-breaking change which fixes an issue)
  • [ ] New Feature 🚀 (non-breaking change which adds functionality)
  • [ ] Breaking Change 💥 (fix or feature that would cause existing functionality to not work as expected)
  • [ x ] Polish 💅 (Just some cleanups)
  • [ ] Docs 📝 (Changes in the documentations)
  • [ ] Internal 🏠 Only relates to internal processes.

How to test it

Write a new review in the Product Detail Page, submit it and the try to change it again. The previous state of the review shouldn't be visible when submitting the form.

@devbucket devbucket added bug Something isn't working PR: Polish 💅 labels Oct 11, 2018
@devbucket devbucket self-assigned this Oct 11, 2018
@coveralls
Copy link

coveralls commented Oct 11, 2018

Pull Request Test Coverage Report for Build 1143

  • 2 of 18 (11.11%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 47.207%

Changes Missing Coverage Covered Lines Changed/Added Lines %
themes/theme-gmd/pages/WriteReview/components/ReviewForm/components/FormButtons/connector.js 1 4 25.0%
themes/theme-gmd/pages/WriteReview/components/ReviewForm/connector.js 1 14 7.14%
Totals Coverage Status
Change from base Build 1134: -0.1%
Covered Lines: 4117
Relevant Lines: 8307

💛 - Coveralls

this.setState(prevState => ({
productId,
...review,
...!prevState[FIELD_NAME_AUTHOR] && { [FIELD_NAME_AUTHOR]: (author || authorName) },
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please make this a little more digestible

@richardgorman richardgorman merged commit 47799ec into PWA-327-Exchange-Router Oct 11, 2018
@richardgorman richardgorman deleted the PWA-1007-fix-create-review-visual-bug branch October 11, 2018 11:27
SG-Noxoreos pushed a commit that referenced this pull request Oct 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants