Sort manage products list

This commit is contained in:
beatz174-bit
2025-11-24 07:23:19 +10:00
parent b01fc87403
commit 46793af5d3
+6 -1
View File
@@ -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}