Skip to content

Commit d465b01

Browse files
committed
fix: make orderBy dataType optional in SDK query
Keep passing inferred dataType when available, but allow orderBy queries to proceed without it so API-side fallback logic can resolve property types.
1 parent 34e845f commit d465b01

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

packages/hypergraph/src/entity/find-many-public.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const buildEntitiesQuery = (
5050
: undefined,
5151
'$typeIds: [UUID!]!',
5252
useOrderBy ? '$propertyId: UUID!' : undefined,
53-
useOrderBy ? '$dataType: String!' : undefined,
53+
useOrderBy ? '$dataType: String' : undefined,
5454
useOrderBy ? '$sortDirection: SortOrder!' : undefined,
5555
'$first: Int',
5656
'$filter: EntityFilter!',
@@ -307,9 +307,6 @@ export const findManyPublic = async <
307307
}
308308

309309
orderByDataType = Utils.getOrderByDataType(propertyType);
310-
if (!orderByDataType) {
311-
throw new Error(`Property "${String(orderBy.property)}" cannot be used in orderBy`);
312-
}
313310

314311
orderByPropertyId = propertyIdAnnotation.value;
315312
sortDirection = orderBy.direction === 'asc' ? 'ASC' : 'DESC';
@@ -336,9 +333,11 @@ export const findManyPublic = async <
336333
queryVariables.spaceIds = spaceSelection.spaceIds;
337334
}
338335

339-
if (orderByPropertyId && orderByDataType && sortDirection) {
336+
if (orderByPropertyId && sortDirection) {
340337
queryVariables.propertyId = orderByPropertyId;
341-
queryVariables.dataType = orderByDataType;
338+
if (orderByDataType) {
339+
queryVariables.dataType = orderByDataType;
340+
}
342341
queryVariables.sortDirection = sortDirection;
343342
}
344343

0 commit comments

Comments
 (0)