Skip to content

Commit f3aae7b

Browse files
committed
Fix: a few review issues
1 parent 08804cc commit f3aae7b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/utils/transformer.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { ISTKData, ISeat } from "@/types";
55
import { rgbToHex } from ".";
66
import { default as d3Extended } from "./d3";
77

8-
const domSeatsToJSON = (seats: ISeat[]) => {
9-
const seatsFromStore: Record<string, ISeat> = seats.reduce((acc, seat) => {
8+
const domSeatsToJSON = (seatsFromStore: ISeat[] | Record<string, ISeat>) => {
9+
seatsFromStore = (seatsFromStore as ISeat[]).reduce((acc, seat) => {
1010
acc[seat.id] = seat;
1111
return acc;
1212
}, {});
@@ -17,7 +17,8 @@ const domSeatsToJSON = (seats: ISeat[]) => {
1717
id,
1818
x: +seat.attr(square ? "x" : "cx"),
1919
y: +seat.attr(square ? "y" : "cy"),
20-
label: document.getElementById(`${seat.attr("id")}-label`)?.textContent?.trim() ?? seatsFromStore[id]?.label,
20+
label:
21+
document.getElementById(`${seat.attr("id")}-label`)?.textContent?.trim() ?? seatsFromStore[id]?.label?.trim(),
2122
status: seat.attr(dataAttributes.status),
2223
category: seat.attr(dataAttributes.category),
2324
square,

0 commit comments

Comments
 (0)