Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix commented issues
Krzysztof Bialoglowicz10da5e4cd206
diff --git a/saleor/static/dashboard-next/productTypes/fixtures.ts b/saleor/static/dashboard-next/productTypes/fixtures.tsindex b8d80ee104..83d512b039 100644--- a/saleor/static/dashboard-next/productTypes/fixtures.ts+++ b/saleor/static/dashboard-next/productTypes/fixtures.ts@@ -594,10 +594,10 @@ export const productType: ProductTypeDetails_productType = {description: "PH405458",taxCode: "Shields"},+ variantAttributes: [attributes[1], attributes[6]],weight: {__typename: "Weight",unit: "kg",value: 7.82- },- variantAttributes: [attributes[1], attributes[6]]+ }};diff --git a/saleor/static/dashboard-next/productTypes/views/ProductTypeCreate.tsx b/saleor/static/dashboard-next/productTypes/views/ProductTypeCreate.tsxindex 31b542f9d9..ec9c02b4c0 100644--- a/saleor/static/dashboard-next/productTypes/views/ProductTypeCreate.tsx+++ b/saleor/static/dashboard-next/productTypes/views/ProductTypeCreate.tsx@@ -4,7 +4,7 @@ import { WindowTitle } from "@saleor/components/WindowTitle";import useNavigator from "@saleor/hooks/useNavigator";import useNotifier from "@saleor/hooks/useNotifier";import i18n from "../../i18n";-import { maybe } from "../../misc";+import { getMutationState, maybe } from "../../misc";import ProductTypeCreatePage, {ProductTypeForm} from "../components/ProductTypeCreatePage";@@ -29,8 +29,9 @@ export const ProductTypeCreate: React.StatelessComponent = () => {<TypedProductTypeCreateMutation onCompleted={handleCreateSuccess}>{(createProductType,- { loading: loadingCreate, data: createProductTypeData }+ { called, loading, data: createProductTypeData }) => {+ const formTransitionState = getMutationState(loading, called);const handleCreate = (formData: ProductTypeForm) =>createProductType({variables: {@@ -50,7 +51,7 @@ export const ProductTypeCreate: React.StatelessComponent = () => {<WindowTitle title={i18n.t("Create product type")} /><ProductTypeCreatePagedefaultWeightUnit={maybe(() => data.shop.defaultWeightUnit)}- disabled={loadingCreate || loading}+ disabled={loading}errors={createProductTypeData? createProductTypeData.productTypeCreate.errors@@ -59,14 +60,8 @@ export const ProductTypeCreate: React.StatelessComponent = () => {pageTitle={i18n.t("Create Product Type", {context: "page title"})}- saveButtonBarState={loadingCreate ? "loading" : "default"}- taxTypes={maybe(() => data.taxTypes, [- {- __typename: "TaxType",- description: "",- taxCode: ""- }- ])}+ saveButtonBarState={formTransitionState}+ taxTypes={maybe(() => data.taxTypes, [])}onBack={() => navigate(productTypeListUrl())}onSubmit={handleCreate}/>diff --git a/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/index.tsx b/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/index.tsxindex 00225e004a..474102a594 100644--- a/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/index.tsx+++ b/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/index.tsx@@ -223,6 +223,14 @@ export const ProductTypeUpdate: React.StatelessComponent<));+ const formTransitionState = getMutationState(+ updateProductType.opts.called,+ updateProductType.opts.loading,+ maybe(+ () => updateProductType.opts.data.productTypeUpdate.errors+ )+ );+const attribute = maybe(() =>data.productType.productAttributes.concat(data.productType.variantAttributes)@@ -240,14 +248,8 @@ export const ProductTypeUpdate: React.StatelessComponent<errors={errors.formErrors}pageTitle={maybe(() => data.productType.name)}productType={maybe(() => data.productType)}- saveButtonBarState={loading ? "loading" : "default"}- taxTypes={maybe(() => data.taxTypes, [- {- __typename: "TaxType",- description: "",- taxCode: ""- }- ])}+ saveButtonBarState={formTransitionState}+ taxTypes={maybe(() => data.taxTypes, [])}onAttributeAdd={type =>navigate(productTypeUrl(id, {