NodeGraph: Fix edges dataframe miscategorization (#76842)

* in node graph, fix edges dataframe miscategorization

A dataframe named "edges" could end up getting categorized as a nodes dataframe if it was missing a "source" field, resulting in a very confusing error message "id field is required for nodes dataframe" instead of a more sensible error message about the missing source field.

* Fix lint

---------

Co-authored-by: Andrej Ocenas <mr.ocenas@gmail.com>
This commit is contained in:
Ophir LOJKINE 2023-10-23 10:30:58 +02:00 committed by GitHub
parent a26318714f
commit 4b6b3b7018
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -607,7 +607,7 @@ export const getGraphFrame = (frames: DataFrame[]) => {
return frames.reduce<GraphFrame>(
(acc, frame) => {
const sourceField = frame.fields.filter((f) => f.name === 'source');
if (sourceField.length) {
if (frame.name === 'edges' || sourceField.length) {
acc.edges.push(frame);
} else {
acc.nodes.push(frame);