Skip to content

Commit 2c5b57e

Browse files
committed
add more fallbacks
1 parent a273809 commit 2c5b57e

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

packages/hypergraph/src/utils/convert-property-value.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,24 @@ export const convertPropertyValue = (
1212
return property.string;
1313
}
1414
if (propertyType.value === 'boolean') {
15-
return Boolean(property.boolean);
15+
// Handle case where number is stored as string in the API
16+
if (property.boolean != null) {
17+
return Boolean(property.boolean);
18+
}
19+
if (property.string != null) {
20+
return Boolean(property.string);
21+
}
22+
return undefined;
1623
}
1724
if (propertyType.value === 'point') {
18-
return property.point;
25+
// Handle case where point is stored as string in the API
26+
if (property.point != null) {
27+
return property.point;
28+
}
29+
if (property.string != null) {
30+
return property.point;
31+
}
32+
return undefined;
1933
}
2034
if (propertyType.value === 'number') {
2135
// Handle case where number is stored as string in the API
@@ -28,7 +42,14 @@ export const convertPropertyValue = (
2842
return undefined;
2943
}
3044
if (propertyType.value === 'date') {
31-
return property.time;
45+
// Handle case where date is stored as string in the API
46+
if (property.time != null) {
47+
return new Date(property.time);
48+
}
49+
if (property.string != null) {
50+
return new Date(property.string);
51+
}
52+
return undefined;
3253
}
3354
}
3455
};

0 commit comments

Comments
 (0)