Skip to content

Commit

Permalink
fix: 🐛 check if mutation field is defined in applyDataQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
dennemark committed Oct 15, 2024
1 parent 3c19d18 commit 9515111
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/applyDataQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function applyDataQuery(
if (permittedFields?.includes(field) === false && !relationModel) {
// if fields are not permitted we throw an error and exit
throw new Error(`It's not allowed to "${action}" "${field}" on "${model}"`)
} else if (relationModel) {
} else if (relationModel && mutation[field]) {
// if additional relations are found, we apply data query on them, too
Object.entries(mutation[field]).forEach(([nestedAction, nestedArgs]) => {
if (nestedAction in caslNestedOperationDict) {
Expand Down

0 comments on commit 9515111

Please sign in to comment.