tf-checkout-react 1.4.5 → 1.4.6

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,5 +1,5 @@
1
1
  {
2
- "version": "1.4.5",
2
+ "version": "1.4.6",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -78,6 +78,7 @@ export const SeatMapContainer = (props: IMapContainerProps) => {
78
78
  const [guestCounts, setGuestCounts] = useState<IGuestCounts>(
79
79
  {} as IGuestCounts
80
80
  )
81
+ const isGuestCountsSet = useRef(false)
81
82
 
82
83
  const updateGuestCounts = (data: any) => {
83
84
  _forEach(data, (item: any) => {
@@ -85,10 +86,10 @@ export const SeatMapContainer = (props: IMapContainerProps) => {
85
86
  const seatTicketsArray = _values(tierTickets)
86
87
 
87
88
  setGuestCounts((prevState: any) => ({
88
- ...prevState,
89
89
  [item.seatId]: Number(
90
90
  seatTicketsArray[0].ticket_type_min_number_of_guests
91
91
  ),
92
+ ...prevState,
92
93
  }))
93
94
  })
94
95
  }
@@ -151,7 +152,10 @@ export const SeatMapContainer = (props: IMapContainerProps) => {
151
152
  setReservedSeats(reservationData)
152
153
  // automatically set ticket/table type if it's the only one
153
154
  if (ticketTypeTierRelationsRef.current) {
154
- updateGuestCounts(reservationData)
155
+ if (!isGuestCountsSet.current) {
156
+ updateGuestCounts(reservationData)
157
+ isGuestCountsSet.current = true
158
+ }
155
159
  _forEach(reservationData, (item: any) => {
156
160
  const tierTickets = ticketTypeTierRelationsRef.current[item.tierId]
157
161
  const seatTicketsArray = _values(tierTickets)