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

Use hooks instead of containers with render props in product mutations #667

Merged
merged 8 commits into from
Aug 25, 2020

Conversation

dominik-zeglen
Copy link
Contributor

I want to merge this change because it simplifies code and removes obsolete pattern. Also makes life easier when you want to type return functions as () => Promise instead of () => void.

PR intended to be tested with API branch: master

Pull Request Checklist

  1. All visible strings are translated with proper context.
  2. All data-formatting is locale-aware (dates, numbers, and so on).
  3. Translated strings are extracted.
  4. Number of API calls is optimized.
  5. The changes are tested.
  6. Data-test are added for new elements.
  7. Type definitions are up to date.
  8. Changes are mentioned in the changelog.

Test environment config

API_URI=https://master.staging.saleor.rocks/graphql/

@github-actions github-actions bot temporarily deployed to ref-product-update-hooks August 24, 2020 10:45 Inactive
@github-actions github-actions bot temporarily deployed to ref-product-update-hooks August 24, 2020 10:46 Inactive
})}
/>
<ProductCreatePage
currency={maybe(() => shop.defaultCurrency)}
Copy link
Contributor

Choose a reason for hiding this comment

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

we can remove maybe

Copy link
Contributor Author

Choose a reason for hiding this comment

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

More like shop?.defaultCurrency, but yeah

if (variant) {
if (
variant.images &&
variant.images.map(image => image.id).indexOf(id) !== -1
Copy link
Contributor

Choose a reason for hiding this comment

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

variant.images?.map

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn't touch this, but I'll fix it

@github-actions github-actions bot temporarily deployed to ref-product-update-hooks August 25, 2020 09:42 Inactive
@dominik-zeglen dominik-zeglen merged commit 03f03d4 into master Aug 25, 2020
@dominik-zeglen dominik-zeglen deleted the ref/product-update-hooks branch August 25, 2020 11:13
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.

3 participants