Skip to content

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

Persist selection state

dominik-zeglen2fc37e16462a
diff --git a/saleor/static/dashboard-next/categories/views/CategoryDetails.tsx b/saleor/static/dashboard-next/categories/views/CategoryDetails.tsx
index 12b654af9c..b48ef055bc 100644
--- a/saleor/static/dashboard-next/categories/views/CategoryDetails.tsx
+++ b/saleor/static/dashboard-next/categories/views/CategoryDetails.tsx
@@ -56,7 +56,9 @@ export const CategoryDetails: React.StatelessComponent<
const navigate = useNavigator();
const notify = useNotifier();
const paginate = usePaginator();
- const { isSelected, listElements, reset, toggle } = useBulkActions();
+ const { isSelected, listElements, reset, toggle } = useBulkActions(
+ params.ids
+ );
const handleCategoryDelete = (data: CategoryDelete) => {
if (data.categoryDelete.errors.length === 0) {
diff --git a/saleor/static/dashboard-next/categories/views/CategoryList.tsx b/saleor/static/dashboard-next/categories/views/CategoryList.tsx
index 00112a1916..24933d45e6 100644
--- a/saleor/static/dashboard-next/categories/views/CategoryList.tsx
+++ b/saleor/static/dashboard-next/categories/views/CategoryList.tsx
@@ -32,7 +32,9 @@ export const CategoryList: React.StatelessComponent<CategoryListProps> = ({
}) => {
const navigate = useNavigator();
const paginate = usePaginator();
- const { isSelected, listElements, toggle, reset } = useBulkActions();
+ const { isSelected, listElements, toggle, reset } = useBulkActions(
+ params.ids
+ );
const paginationState = createPaginationState(PAGINATE_BY, params);
return (
diff --git a/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx b/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx
index 510e2935ae..64fd9730a2 100644
--- a/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx
+++ b/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx
@@ -43,7 +43,9 @@ export const CollectionDetails: React.StatelessComponent<
> = ({ id, params }) => {
const navigate = useNavigator();
const notify = useNotifier();
- const { isSelected, listElements, reset, toggle } = useBulkActions();
+ const { isSelected, listElements, reset, toggle } = useBulkActions(
+ params.ids
+ );
const paginate = usePaginator();
const closeModal = () =>
diff --git a/saleor/static/dashboard-next/collections/views/CollectionList.tsx b/saleor/static/dashboard-next/collections/views/CollectionList.tsx
index ef4980aef6..b30e5c6cfd 100644
--- a/saleor/static/dashboard-next/collections/views/CollectionList.tsx
+++ b/saleor/static/dashboard-next/collections/views/CollectionList.tsx
@@ -36,7 +36,9 @@ export const CollectionList: React.StatelessComponent<CollectionListProps> = ({
const navigate = useNavigator();
const notify = useNotifier();
const paginate = usePaginator();
- const { isSelected, listElements, reset, toggle } = useBulkActions();
+ const { isSelected, listElements, reset, toggle } = useBulkActions(
+ params.ids
+ );
const closeModal = () =>
navigate(
diff --git a/saleor/static/dashboard-next/customers/views/CustomerList.tsx b/saleor/static/dashboard-next/customers/views/CustomerList.tsx
index 01c02ca869..5c4b7cad5a 100644
--- a/saleor/static/dashboard-next/customers/views/CustomerList.tsx
+++ b/saleor/static/dashboard-next/customers/views/CustomerList.tsx
@@ -34,7 +34,9 @@ export const CustomerList: React.StatelessComponent<CustomerListProps> = ({
const navigate = useNavigator();
const notify = useNotifier();
const paginate = usePaginator();
- const { isSelected, listElements, reset, toggle } = useBulkActions();
+ const { isSelected, listElements, reset, toggle } = useBulkActions(
+ params.ids
+ );
const closeModal = () =>
navigate(
diff --git a/saleor/static/dashboard-next/discounts/views/SaleDetails.tsx b/saleor/static/dashboard-next/discounts/views/SaleDetails.tsx
index a913c22ba3..51000e831a 100644
--- a/saleor/static/dashboard-next/discounts/views/SaleDetails.tsx
+++ b/saleor/static/dashboard-next/discounts/views/SaleDetails.tsx
@@ -64,7 +64,9 @@ export const SaleDetails: React.StatelessComponent<SaleDetailsProps> = ({
const paginate = usePaginator();
const notify = useNotifier();
const shop = useShop();
- const { isSelected, listElements, reset, toggle } = useBulkActions();
+ const { isSelected, listElements, reset, toggle } = useBulkActions(
+ params.ids
+ );
const paginationState = createPaginationState(PAGINATE_BY, params);
const changeTab = (tab: SaleDetailsPageTab) => {
diff --git a/saleor/static/dashboard-next/discounts/views/SaleList.tsx b/saleor/static/dashboard-next/discounts/views/SaleList.tsx
index 49eeec5ce8..b4c4d912ed 100644
--- a/saleor/static/dashboard-next/discounts/views/SaleList.tsx
+++ b/saleor/static/dashboard-next/discounts/views/SaleList.tsx
@@ -37,7 +37,9 @@ export const SaleList: React.StatelessComponent<SaleListProps> = ({
const notify = useNotifier();
const paginate = usePaginator();
const shop = useShop();
- const { isSelected, listElements, reset, toggle } = useBulkActions();
+ const { isSelected, listElements, reset, toggle } = useBulkActions(
+ params.ids
+ );
const closeModal = () => navigate(saleListUrl(), true);
diff --git a/saleor/static/dashboard-next/discounts/views/VoucherDetails.tsx b/saleor/static/dashboard-next/discounts/views/VoucherDetails.tsx
index 57554a4107..e07418b1d8 100644
--- a/saleor/static/dashboard-next/discounts/views/VoucherDetails.tsx
+++ b/saleor/static/dashboard-next/discounts/views/VoucherDetails.tsx
@@ -70,7 +70,9 @@ export const VoucherDetails: React.StatelessComponent<VoucherDetailsProps> = ({
const paginate = usePaginator();
const notify = useNotifier();
const shop = useShop();
- const { isSelected, listElements, reset, toggle } = useBulkActions();
+ const { isSelected, listElements, reset, toggle } = useBulkActions(
+ params.ids
+ );
const paginationState = createPaginationState(PAGINATE_BY, params);
const changeTab = (tab: VoucherDetailsPageTab) => {
diff --git a/saleor/static/dashboard-next/discounts/views/VoucherList.tsx b/saleor/static/dashboard-next/discounts/views/VoucherList.tsx
index 37325b167f..13009f29c2 100644
--- a/saleor/static/dashboard-next/discounts/views/VoucherList.tsx
+++ b/saleor/static/dashboard-next/discounts/views/VoucherList.tsx
@@ -37,7 +37,9 @@ export const VoucherList: React.StatelessComponent<VoucherListProps> = ({
const notify = useNotifier();
const paginate = usePaginator();
const shop = useShop();
- const { isSelected, listElements, reset, toggle } = useBulkActions();
+ const { isSelected, listElements, reset, toggle } = useBulkActions(
+ params.ids
+ );
const closeModal = () => navigate(voucherListUrl(), true);
diff --git a/saleor/static/dashboard-next/orders/components/OrderBulkCancelDialog/OrderBulkCancelDialog.tsx b/saleor/static/dashboard-next/orders/components/OrderBulkCancelDialog/OrderBulkCancelDialog.tsx
index 087f9a256c..a9b2a259ce 100644
--- a/saleor/static/dashboard-next/orders/components/OrderBulkCancelDialog/OrderBulkCancelDialog.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderBulkCancelDialog/OrderBulkCancelDialog.tsx
@@ -8,7 +8,7 @@ import i18n from "../../../i18n";
export interface OrderBulkCancelDialogProps {
confirmButtonState: ConfirmButtonTransitionState;
- number: string;
+ numberOfOrders: string;
open: boolean;
onClose: () => void;
onConfirm: (restock: boolean) => void;
@@ -16,7 +16,7 @@ export interface OrderBulkCancelDialogProps {
const OrderBulkCancelDialog: React.StatelessComponent<
OrderBulkCancelDialogProps
-> = ({ confirmButtonState, number, open, onClose, onConfirm }) => {
+> = ({ confirmButtonState, numberOfOrders, open, onClose, onConfirm }) => {
const [restock, setRestock] = React.useState(true);
return (
@@ -33,7 +33,7 @@ const OrderBulkCancelDialog: React.StatelessComponent<
__html: i18n.t(
"Are you sure you want to cancel <strong>{{ number }}</strong> orders?",
{
- number
+ number: numberOfOrders
}
)
}}
diff --git a/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx b/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx
index d377b87eec..ede9bb0941 100644
--- a/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx
@@ -11,6 +11,7 @@ import { DateTime } from "../../../components/Date";
import Money from "../../../components/Money";
import Skeleton from "../../../components/Skeleton";
import StatusLabel from "../../../components/StatusLabel";
+import TableHead from "../../../components/TableHead";
import TablePagination from "../../../components/TablePagination";
import i18n from "../../../i18n";
import {
@@ -21,7 +22,6 @@ import {
} from "../../../misc";
import { ListActions, ListProps } from "../../../types";
import { OrderList_orders_edges_node } from "../../types/OrderList";
-import TableHead from "../../../components/TableHead";
const styles = createStyles({
link: {
diff --git a/saleor/static/dashboard-next/orders/views/OrderDraftList.tsx b/saleor/static/dashboard-next/orders/views/OrderDraftList.tsx
index 77305a5d43..7f2ad021a2 100644
--- a/saleor/static/dashboard-next/orders/views/OrderDraftList.tsx
+++ b/saleor/static/dashboard-next/orders/views/OrderDraftList.tsx
@@ -37,7 +37,9 @@ export const OrderDraftList: React.StatelessComponent<OrderDraftListProps> = ({
const navigate = useNavigator();
const notify = useNotifier();
const paginate = usePaginator();
- const { isSelected, listElements, reset, toggle } = useBulkActions();
+ const { isSelected, listElements, reset, toggle } = useBulkActions(
+ params.ids
+ );
const closeModal = () =>
navigate(
diff --git a/saleor/static/dashboard-next/orders/views/OrderList.tsx b/saleor/static/dashboard-next/orders/views/OrderList.tsx
index 3be09f3092..fca8aefc2a 100644
--- a/saleor/static/dashboard-next/orders/views/OrderList.tsx
+++ b/saleor/static/dashboard-next/orders/views/OrderList.tsx
@@ -174,7 +174,7 @@ export const OrderList: React.StatelessComponent<OrderListProps> = ({
/>
<OrderBulkCancelDialog
confirmButtonState={orderBulkCancelTransitionState}
- number={maybe(
+ numberOfOrders={maybe(
() => params.ids.length.toString(),
"..."
)}
diff --git a/saleor/static/dashboard-next/pages/views/PageList.tsx b/saleor/static/dashboard-next/pages/views/PageList.tsx
index 23ecb77759..67870446fb 100644
--- a/saleor/static/dashboard-next/pages/views/PageList.tsx
+++ b/saleor/static/dashboard-next/pages/views/PageList.tsx
@@ -43,7 +43,9 @@ export const PageList: React.StatelessComponent<PageListProps> = ({
const navigate = useNavigator();
const notify = useNotifier();
const paginate = usePaginator();
- const { isSelected, listElements, reset, toggle } = useBulkActions();
+ const { isSelected, listElements, reset, toggle } = useBulkActions(
+ params.ids
+ );
const paginationState = createPaginationState(PAGINATE_BY, params);
diff --git a/saleor/static/dashboard-next/productTypes/views/ProductTypeList.tsx b/saleor/static/dashboard-next/productTypes/views/ProductTypeList.tsx
index 72c04ded8a..eb4e3ef4b2 100644
--- a/saleor/static/dashboard-next/productTypes/views/ProductTypeList.tsx
+++ b/saleor/static/dashboard-next/productTypes/views/ProductTypeList.tsx
@@ -35,7 +35,9 @@ export const ProductTypeList: React.StatelessComponent<
const navigate = useNavigator();
const notify = useNotifier();
const paginate = usePaginator();
- const { isSelected, listElements, reset, toggle } = useBulkActions();
+ const { isSelected, listElements, reset, toggle } = useBulkActions(
+ params.ids
+ );
const closeModal = () => navigate(productTypeListUrl(), true);
diff --git a/saleor/static/dashboard-next/products/views/ProductList.tsx b/saleor/static/dashboard-next/products/views/ProductList.tsx
index f628f47f0e..0aa71e0b2c 100644
--- a/saleor/static/dashboard-next/products/views/ProductList.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductList.tsx
@@ -39,7 +39,9 @@ export const ProductList: React.StatelessComponent<ProductListProps> = ({
const navigate = useNavigator();
const notify = useNotifier();
const paginate = usePaginator();
- const { isSelected, listElements, reset, toggle } = useBulkActions();
+ const { isSelected, listElements, reset, toggle } = useBulkActions(
+ params.ids
+ );
const closeModal = () =>
navigate(
diff --git a/saleor/static/dashboard-next/products/views/ProductUpdate.tsx b/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
index e733e1780d..a559dd0cde 100644
--- a/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
@@ -43,7 +43,9 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({
}) => {
const navigate = useNavigator();
const notify = useNotifier();
- const { isSelected, listElements, reset, toggle } = useBulkActions();
+ const { isSelected, listElements, reset, toggle } = useBulkActions(
+ params.ids
+ );
return (
<CategorySearchProvider>
diff --git a/saleor/static/dashboard-next/shipping/views/ShippingZonesList.tsx b/saleor/static/dashboard-next/shipping/views/ShippingZonesList.tsx
index 17273fdd42..507d2df2be 100644
--- a/saleor/static/dashboard-next/shipping/views/ShippingZonesList.tsx
+++ b/saleor/static/dashboard-next/shipping/views/ShippingZonesList.tsx
@@ -43,7 +43,9 @@ export const ShippingZonesList: React.StatelessComponent<
const notify = useNotifier();
const paginate = usePaginator();
const shop = useShop();
- const { isSelected, listElements, reset, toggle } = useBulkActions();
+ const { isSelected, listElements, reset, toggle } = useBulkActions(
+ params.ids
+ );
const paginationState = createPaginationState(PAGINATE_BY, params);
diff --git a/saleor/static/dashboard-next/staff/views/StaffList.tsx b/saleor/static/dashboard-next/staff/views/StaffList.tsx
index 97dace9b73..db372d9664 100644
--- a/saleor/static/dashboard-next/staff/views/StaffList.tsx
+++ b/saleor/static/dashboard-next/staff/views/StaffList.tsx
@@ -41,7 +41,9 @@ export const StaffList: React.StatelessComponent<StaffListProps> = ({
const navigate = useNavigator();
const notify = useNotifier();
const paginate = usePaginator();
- const { isSelected, listElements, reset, toggle } = useBulkActions();
+ const { isSelected, listElements, reset, toggle } = useBulkActions(
+ params.ids
+ );
const closeModal = () =>
navigate(