evolutionary-blush
evolutionary-blush•2y ago

selectionSet issue

Error: unexpected null value for type "uuid": {"response":{"errors":[{"extensions":{"path":"$.selectionSet.user_patients.args.where.id._eq","code":"validation-failed"},"message":"unexpected null value for type "uuid""}],"status":200,"headers":{"map":{"content-type":"application/json; charset=utf-8"}}},"request":{"query":"query ($limit: Int, $offset: Int, $where: user_patients_bool_exp) { user_patients (limit: $limit, offset: $offset, where: $where) { id, name, date_of_birth, gender, active } user_patients_aggregate (where: $where) { aggregate { count } } }","variables":{"limit":10,"offset":0,"where":{"id":{"_eq":null}}}}} at index.js:591:1 at step (index.js:174:1) at Object.next (index.js:105:1) at fulfilled (index.js:59:1) onError @ query.js:356
5 Replies
Omer
Omer•2y ago
Hey @coops8 , It seems you are not sending the id field. Can you share the details of your hasura table and the code with us?
evolutionary-blush
evolutionary-blush•2y ago
Thanks @Omer the problem has been solved 🙂
Omer
Omer•2y ago
cool. What exactly was the error? 👀
evolutionary-blush
evolutionary-blush•2y ago
Hi @Omer, the issue was taking data from the database and pass that data from one component to another. So I did like this... 1st component. const [patient, setPatient] = useState<any>(null); const { selectProps } = useSelect<INewBill>({ resource: "user_patients", optionValue: "id", optionLabel: "name", metaData: { fields: ["id", "name", "date_of_birth", "gender", "active"], }, fetchSize: 20, queryOptions: { enabled: true, }, }); <CustomSelect {...selectProps} label={" "} selectedOption={false} style={{ width: "300px", margin: "10px 0 10px 0", }} size="large" placeholder={"Search Patient Name or Number"} onSelect={(...selectProps: any) => setPatient({ ...selectProps?.map((value: any) => value), }) } /> Then passed that into the 2nd component like this... {patient !== null ? <BillingComponent patient={patient} /> : null} In the 2nd component I used... const patientQueryResult = useOne<INewBill>({ resource: "user_patients", id: patient[0], metaData: { fields: ["id", "name", "date_of_birth", "gender", "active"], }, }); now after using the useOne hook I got a single object from array of objects and then use it according to my needs in the UI logic
Omer
Omer•2y ago
I got it. Thank you! âš¡