Skip to content

Commit 804ed93

Browse files
committed
fix: improve null safety checks in migration service by removing optional chaining
1 parent 1d9f69c commit 804ed93

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

api/src/services/migration.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,12 @@ const transformAndFlattenData = (data: any): Array<{ [key: string]: any, id: num
248248
const flattenedItems: Array<{ [key: string]: any }> = [];
249249

250250
// Handle the data based on its structure
251-
if (Array?.isArray(data)) {
251+
if (Array.isArray(data)) {
252252
// If data is already an array, use it directly
253253
data.forEach((item, index) => {
254-
flattenedItems?.push({
254+
flattenedItems.push({
255255
...item ?? {},
256-
uid: item?.uid || `item-${index}`
256+
uid: item.uid || `item-${index}`
257257
});
258258
});
259259
} else if (typeof data === 'object' && data !== null) {
@@ -267,7 +267,7 @@ const transformAndFlattenData = (data: any): Array<{ [key: string]: any, id: num
267267
});
268268
});
269269
} else if (typeof value === 'object' && value !== null) {
270-
flattenedItems?.push({
270+
flattenedItems.push({
271271
...value,
272272
key,
273273
uid: (value as any)?.uid || key

0 commit comments

Comments
 (0)