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 creating simple products without categories #1337

Merged

Conversation

SektorDV
Copy link
Contributor

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

  1. This code contains UI changes
  2. All visible strings are translated with proper context including data-formatting
  3. Attributes [data-test-id] are added for new elements
  4. Changes are mentioned in the changelog
  5. The changes are tested in different browsers and in light/dark mode

Test environment config

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

@SektorDV SektorDV requested review from eCzerniak, a team, dominik-zeglen and bmigirl and removed request for a team August 26, 2021 16:30
@github-actions github-actions bot temporarily deployed to saleor-3606-3-0-creating-simple-products-without-categories August 26, 2021 16:30 Inactive
@@ -312,7 +311,8 @@ function useProductCreateForm(
data.channelListings.some(
channel =>
validatePrice(channel.price) || validateCostPrice(channel.costPrice)
));
) ||
!data.category);
Copy link
Contributor

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?

Copy link
Contributor

Choose a reason for hiding this comment

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

What he said ^

Copy link
Contributor Author

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?

Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

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

What he said ^

@SektorDV SektorDV requested review from bmigirl and orzechdev August 30, 2021 14:45
@@ -312,7 +311,8 @@ function useProductCreateForm(
data.channelListings.some(
channel =>
validatePrice(channel.price) || validateCostPrice(channel.costPrice)
));
) ||
!data.category);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe you're right

@jwm0 jwm0 changed the title fix creating simple products without categories Fix creating simple products without categories Sep 3, 2021
@jwm0 jwm0 merged commit c04c38e into 3.0 Sep 3, 2021
@jwm0 jwm0 deleted the SALEOR-3606/3.0/creating-simple-products-without-categories branch September 3, 2021 11:22
jwm0 added a commit that referenced this pull request Sep 3, 2021
Co-authored-by: SektorDV <35644259+SektorDV@users.noreply.github.com>
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.

7 participants