Sort manage products list
This commit is contained in:
@@ -147,6 +147,11 @@ export const ManageProductsScreen = () => {
|
|||||||
[products, search],
|
[products, search],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const sortedFiltered = useMemo(
|
||||||
|
() => filtered.slice().sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase())),
|
||||||
|
[filtered],
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const state = location.state as { newBarcode?: string } | null;
|
const state = location.state as { newBarcode?: string } | null;
|
||||||
if (state?.newBarcode) {
|
if (state?.newBarcode) {
|
||||||
@@ -319,7 +324,7 @@ export const ManageProductsScreen = () => {
|
|||||||
Save Product
|
Save Product
|
||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
{filtered.map((product) => (
|
{sortedFiltered.map((product) => (
|
||||||
<ProductRow
|
<ProductRow
|
||||||
key={product.id}
|
key={product.id}
|
||||||
product={product}
|
product={product}
|
||||||
|
|||||||
Reference in New Issue
Block a user