wpengine / atlas-content-modeler

Content modeling plugin for WordPress
https://developers.wpengine.com/docs/atlas-content-modeler
GNU General Public License v2.0
165 stars 13 forks source link

MERL-1192 - Fix return errors on relationships with no connections #675

Closed mindctrl closed 10 months ago

mindctrl commented 10 months ago

Return null instead of array of empty nodes and edges.

Closes #663.

Related: See previous fix related to this here: https://github.com/wpengine/atlas-content-modeler/pull/648

Description

Return value has changed from an array of empty nodes/edges to null.

https://wpengine.atlassian.net/browse/MERL-1192

Checklist

I have:

Testing

Added automated test to confirm behavior of relationships with no connections.

To test manually, start on the main branch.

Create a relationship field from one model to another, make sure it is not a "required" field. Add a single post entry for one of the models. Do not add a connection to the other model. Save the post.

Query the model posts in GraphiQL. Tip: If you go to Atlas Content Modeler > Models, click on the dropdown menu on the right side of your model (three dot icon), select Open in GraphiQL. Screenshot: image

Run the query. You should see errors on the main branch.

Check out this branch and repeat the same query. You should not see errors.