ordering-ui-react-native 0.17.75 → 0.17.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.17.75",
3
+ "version": "0.17.76",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -72,9 +72,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
72
72
 
73
73
  useEffect(() => {
74
74
  if (loading || error) return
75
- const orders = _orders.map((order: any) => order?.cart_group_id
76
- ? _orders
77
- .filter((_order : any) => _order?.cart_group_id === order?.cart_group_id)
75
+ const ordersReduced = _orders.map((order: any) => order?.cart_group_id
76
+ ? _orders
77
+ ?.filter((_order : any) => _order?.cart_group_id === order?.cart_group_id)
78
78
  ?.reduce((orderCompleted : any, currentOrder : any) => ({
79
79
  ...orderCompleted,
80
80
  total: orderCompleted.summary?.total + currentOrder?.summary?.total,
@@ -84,17 +84,19 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
84
84
  review: orderCompleted.review && currentOrder.review,
85
85
  user_review: orderCompleted.user_review && currentOrder.user_review,
86
86
  products: [orderCompleted.products, currentOrder.products].flat()
87
- })).filter((order: any) => {
88
- const isDuplicate = uniqueOrders.includes(order?.cart_group_id)
89
- if (!isDuplicate) {
90
- uniqueOrders.push(order?.cart_group_id)
91
- return true
92
- }
93
- return false
94
- })
95
- : order)
87
+ }))
88
+ : order)
89
+ const orders = ordersReduced?.filter((order: any) => {
90
+ if (!order?.cart_group_id) return true
91
+ const isDuplicate = uniqueOrders.includes(order?.cart_group_id)
92
+ if (!isDuplicate) {
93
+ uniqueOrders.push(order?.cart_group_id)
94
+ return true
95
+ }
96
+ return false
97
+ })
96
98
  setOrders(orders)
97
- }, [JSON.stringify(_orders)])
99
+ }, [_orders?.length])
98
100
 
99
101
  const getOrderStatus = (s: string) => {
100
102
  const status = parseInt(s)