Logic issue in validation-error-builder
Opened this issue · 0 comments
I believe the code here: https://github.com/graphiti-api/spraypaint.js/blob/master/src/util/validation-error-builder.ts#L71 is lacking an additional presence check of the r.temp_id
and.or meta["temp-id"]
as are done in many other places in the code.
For a relationship where there are no temporary ids on any elements, this causes the first element to be returned always.
Also, it seems there is a type issue with id
s. For all the records I fetch via spraypaint the object's id
is a string. However, the id
coming back in the validation errors is an integer. And thus the ===
won’t match.
I have made a branch of employee-directory
which demonstrates this issue: https://github.com/gstark/employee_directory/tree/demonstrate-validation-error-builder-bug
To run:
bundle && rails db:setup && rails server
In a separate shell:
cd js
yarn install
node demo.js