Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Display chips
dominik-zeglen93631916aff1
diff --git a/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx b/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsxindex 86e84f1c3a..e62320ab74 100644--- a/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx+++ b/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx@@ -40,7 +40,6 @@ interface FormData {publicationDate: string;category: string;chargeTaxes: boolean;- collections: string[];description: RawDraftContentState;isPublished: boolean;name: string;@@ -52,6 +51,7 @@ interface FormData {}export interface ProductCreatePageSubmitData extends FormData {attributes: ProductAttributeInput[];+ collections: string[];}interface ProductCreatePageProps {@@ -111,7 +111,6 @@ export const ProductCreatePage: React.StatelessComponent<basePrice: 0,category: "",chargeTaxes: false,- collections: [],description: {} as any,isPublished: false,name: "",@@ -130,6 +129,7 @@ export const ProductCreatePage: React.StatelessComponent<const handleSubmit = (data: FormData) =>onSubmit({attributes,+ collections: selectedCollections.map(({ value }) => value),...data});diff --git a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsxindex 124f225d71..e882a17a86 100644--- a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx+++ b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx@@ -14,6 +14,7 @@ import VisibilityCard from "@saleor/components/VisibilityCard";import { SearchCategories_categories_edges_node } from "@saleor/containers/SearchCategories/types/SearchCategories";import { SearchCollections_collections_edges_node } from "@saleor/containers/SearchCollections/types/SearchCollections";import useFormset from "@saleor/hooks/useFormset";+import useMultiAutocomplete from "@saleor/hooks/useMultiAutocomplete";import i18n from "@saleor/i18n";import { maybe } from "@saleor/misc";import { ListActions, UserError } from "@saleor/types";@@ -110,9 +111,10 @@ export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({getAttributeInputFromProduct(product));const [selectedCategory, setSelectedCategory] = React.useState("");- const [selectedCollections, setSelectedCollections] = React.useState(- getCollectionInput(productCollections)- );+ const {+ change: selectCollection,+ data: selectedCollections+ } = useMultiAutocomplete(getChoices(productCollections));const initialDescription = maybe<RawDraftContentState>(() =>JSON.parse(product.descriptionJson)@@ -143,11 +145,8 @@ export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({>{({ change, data, errors, hasChanged, submit, triggerChange }) => {const handleCollectionSelect = createCollectionSelectHandler(- data,- collections,- selectedCollections,- setSelectedCollections,- change+ event => selectCollection(event, collections),+ triggerChange);const handleCategorySelect = createCategorySelectHandler(categoryChoiceList,@@ -239,16 +238,14 @@ export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({canChangeType={false}categories={categories}categoryInputDisplayValue={selectedCategory}- collectionInputDisplayValue={selectedCollections- .map(c => c.label)- .join(", ")}+ collections={collections}+ data={data}+ disabled={disabled}errors={errors}fetchCategories={fetchCategories}fetchCollections={fetchCollections}- collections={collections}productType={maybe(() => product.productType)}- data={data}- disabled={disabled}+ selectedCollections={selectedCollections}onCategoryChange={handleCategorySelect}onCollectionChange={handleCollectionSelect}/>diff --git a/saleor/static/dashboard-next/products/views/ProductCreate.tsx b/saleor/static/dashboard-next/products/views/ProductCreate.tsxindex 5a3e66f832..1d4e6efa9c 100644--- a/saleor/static/dashboard-next/products/views/ProductCreate.tsx+++ b/saleor/static/dashboard-next/products/views/ProductCreate.tsx@@ -82,7 +82,7 @@ export const ProductUpdate: React.StatelessComponent<: null,seo: {description: formData.seoDescription,- title: formData.seoTitle,+ title: formData.seoTitle},sku: formData.sku,stockQuantity: