Gadget framework version 1.3.0 has 2 breaking changes that need to be fixed before deploying your apps to production.
Breaking change 1: Existing filters on belongs to relationships must reference the relationship ID field
The introduction of related model filtering to Gadget framework v1.3 brings a breaking change to filters across belongs to relationships.
Existing filters on belongs to relationship fields need to target the generated relationship ID field instead of the relationship name itself on framework version 1.3.0. belongs to relationship fields can now be used to filter for related model records.
For example, if my model author has many post, and I was filtering post records by by related author field:
Example of a filter in framework versions <=1.2
JavaScript
1const posts =await api.post.findMany({
2filter:{
3// filters posts by related author ID = 1
4author:{
5equals:1,
6},
7},
8});
In framework versions 0.0.0 → 1.2.0, this would filter on the ID field auto-generated by Gadget for the belongs to relationship on post.
After upgrading to v1.3.0, I need to explicitly use the relationship's ID field:
Example of a belongs to ID filter in framework v1.3
JavaScript
1const posts =await api.post.findMany({
2filter:{
3// filters posts by related author ID = 1
4authorId:{
5equals:1,
6},
7},
8});
The author identifier has been updated to authorId and the filter will work correctly.
Using a belongs to relationship ID field to filter works in any Gadget framework version.
Breaking change 2: Namespaces are now included in GraphQL typenames
Previous to v1.3.0, there could be a GraphQL typename collision when two models with the same API identifier are present in two different namespaces and those models had relationship fields.
For example, if there were shopify/product and bigcommerce/product data models defined, there would be a collision on GraphQL namespaces such as NestedProductCreateInput.
The namespace is now included in the GraphQL typenames so any collisions are avoided.
There are no migration steps required for this change and this change does not affect requests made using your Gadget API client.
If you have issues with your manually written GraphQL queries after upgrading to v1.3.0 reach out on our Discord.