Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Improve react side of code

dominik-zeglene8cdabb88431
diff --git a/saleor/static/dashboard-next/components/Filter/FilterContent.tsx b/saleor/static/dashboard-next/components/Filter/FilterContent.tsx
index 5dbaa5e046..8db2f331a8 100644
--- a/saleor/static/dashboard-next/components/Filter/FilterContent.tsx
+++ b/saleor/static/dashboard-next/components/Filter/FilterContent.tsx
@@ -73,7 +73,7 @@ const FilterContent: React.FC<FilterContentProps> = ({
menus.map(
(filterItem, filterItemIndex) =>
!isLeaf(filterItem) && (
- <>
+ <React.Fragment key={filterItem.label.toString() + filterItem.value}>
<FormSpacer />
<SingleSelectField
choices={filterItem.children.map(filterItem => ({
@@ -93,7 +93,7 @@ const FilterContent: React.FC<FilterContentProps> = ({
}
placeholder={i18n.t("Select Filter...")}
/>
- </>
+ </React.Fragment>
)
)}
{activeMenu && isLeaf(activeMenu) && (
diff --git a/saleor/static/dashboard-next/components/Filter/FilterElement.tsx b/saleor/static/dashboard-next/components/Filter/FilterElement.tsx
index 0d14ec0d7f..48d6d8db39 100644
--- a/saleor/static/dashboard-next/components/Filter/FilterElement.tsx
+++ b/saleor/static/dashboard-next/components/Filter/FilterElement.tsx
@@ -182,9 +182,10 @@ const FilterElement: React.FC<FilterElementProps> = ({
onChange={event => onChange(event.target.value)}
InputProps={{
classes: {
- input: filter.data.fieldLabel && classes.input
+ input: !filter.data.fieldLabel && classes.input
}
}}
+ value={value as string}
/>
);
}
@@ -197,9 +198,11 @@ const FilterElement: React.FC<FilterElementProps> = ({
label={filter.data.fieldLabel}
InputProps={{
classes: {
- input: filter.data.fieldLabel && classes.input
+ input: !filter.data.fieldLabel && classes.input
}
}}
+ onChange={event => onChange(event.target.value)}
+ value={value as string}
/>
</>
);
diff --git a/saleor/static/dashboard-next/products/components/ProductListFilter/ProductListFilter.tsx b/saleor/static/dashboard-next/products/components/ProductListFilter/ProductListFilter.tsx
index af733274be..1477988ff5 100644
--- a/saleor/static/dashboard-next/products/components/ProductListFilter/ProductListFilter.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductListFilter/ProductListFilter.tsx
@@ -66,7 +66,7 @@ const filterMenu: IFilter = [
{
children: [],
data: {
- fieldLabel: i18n.t("Price"),
+ fieldLabel: null,
type: FieldType.price
},
label: i18n.t("Specific Price"),