constitutional-coralC
Refine17mo ago
14 replies
constitutional-coral

Nodes is not working

@kapa.ai Ok why am I getting this error:
TypeError: Cannot read properties of undefined (reading 'nodes') at getList

If this is the query:

export const OBD_GET_HISTORY = gql query OBDHistory( $filter: OBDDataFilter! $sorting: [OBDDataSort!]! $paging: OffsetPaging!) { historicalObdData(filter: $filter, sorting: $sorting, paging: $paging) { totalCount nodes { id driver { id name } timestamp rpm speed coolantTemp throttlePosition intakeAirTemp fuelLevel engineLoad mafSensor runTime distanceMilOn commandedEgr barometricPressure } } } ;

And this is the refine code:

const { data: responseData, isLoading: locationLoading, failureReason: failureReason } = useList<GetFieldsFromList<ObdHistoryQuery>>({
resource: "obd_data",
filters: [
{
field: "vehicle",
value: vehicleId,
operator: "eq",
}
],
meta: {
gqlQuery: OBD_GET_HISTORY,
},
queryOptions: {
enabled: true,
},
});


And on the network this is the response:
{
"data": {
"historicalObdData": {
"totalCount": 149,
"nodes": [
{
"id": "68",
"driver": {
"id": "2",
"name": "Leroy"
},
"timestamp": "2024-09-07 21:15:28.317170+00:00",
"rpm": 6095,
"speed": 76,
"coolantTemp": 4.0,
"throttlePosition": 68.23529411764706,
...
Was this page helpful?