-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 creating simple products without categories #1337
Fix creating simple products without categories #1337
Conversation
@@ -312,7 +311,8 @@ function useProductCreateForm( | |||
data.channelListings.some( | |||
channel => | |||
validatePrice(channel.price) || validateCostPrice(channel.costPrice) | |||
)); | |||
) || | |||
!data.category); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is quite complicated. Maybe it should be extracted to separate function shouldDisable
or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What he said ^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't that be redundant though? right now it's a boolean calculated based on a number of conditions, so pretty much it does exactly what a function would do. how would this benefit from having its value returned from a function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you're right
@@ -312,7 +311,8 @@ function useProductCreateForm( | |||
data.channelListings.some( | |||
channel => | |||
validatePrice(channel.price) || validateCostPrice(channel.costPrice) | |||
)); | |||
) || | |||
!data.category); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What he said ^
@@ -312,7 +311,8 @@ function useProductCreateForm( | |||
data.channelListings.some( | |||
channel => | |||
validatePrice(channel.price) || validateCostPrice(channel.costPrice) | |||
)); | |||
) || | |||
!data.category); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you're right
I want to merge this change because it disables the save button on product creator when a category has not been set for the created product (the backend expects this).
Pull Request Checklist
[data-test-id]
are added for new elementsTest environment config
API_URI=https://master.staging.saleor.cloud/graphql/