File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
packages/runtime/src/enhancements/policy Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -466,18 +466,16 @@ export class PolicyUtil extends QueryUtils {
466466 continue ;
467467 }
468468
469- const fieldInfo = resolveField ( this . modelMeta , model , field ) ;
470- if ( ! fieldInfo || ! fieldInfo . isDataModel ) {
471- continue ;
472- }
473-
474469 allFieldGuards . push ( this . getFieldReadAuthGuard ( db , model , field ) ) ;
475470 allFieldOverrideGuards . push ( this . getFieldOverrideReadAuthGuard ( db , model , field ) ) ;
476471
477- if ( fieldInfo . isArray ) {
478- this . injectReadGuardForToManyField ( db , fieldInfo , subPayload ) ;
479- } else {
480- this . injectReadGuardForToOneField ( db , fieldInfo , subPayload ) ;
472+ const fieldInfo = resolveField ( this . modelMeta , model , field ) ;
473+ if ( fieldInfo ?. isDataModel ) {
474+ if ( fieldInfo . isArray ) {
475+ this . injectReadGuardForToManyField ( db , fieldInfo , subPayload ) ;
476+ } else {
477+ this . injectReadGuardForToOneField ( db , fieldInfo , subPayload ) ;
478+ }
481479 }
482480 }
483481
You can’t perform that action at this time.
0 commit comments