@@ -400,23 +400,15 @@ export class StoreReader {
400400 }
401401 }
402402
403- let { result, dataState, missing : rawMissing } = execResult ;
404-
405- let missing : MissingFieldError | undefined ;
406- if (
407- execResult . missing &&
403+ let { result, dataState, missing } = execResult ;
404+ // Evaluate this condition before we start mucking with dataState for the
405+ // publicly returned value
406+ const includeMissing =
407+ ! ! missing &&
408408 // We don't need to report missing fields inside defer boundaries since
409409 // the "streaming" dataState tells us that the only missing fields in
410410 // the object is inside a defer boundary.
411- ( dataState !== "streaming" || ! handleIncremental )
412- ) {
413- missing = new MissingFieldError (
414- firstMissing ( execResult . missing ) ! ,
415- execResult . missing ,
416- query ,
417- variables
418- ) ;
419- }
411+ ( dataState !== "streaming" || ! handleIncremental ) ;
420412
421413 // If we get all root @defer boundaries with an empty result, report it as
422414 // empty instead of streaming.
@@ -448,10 +440,10 @@ export class StoreReader {
448440 result : keepResult ? result : null ,
449441 complete,
450442 get missing ( ) {
451- if ( missingError === void 0 && rawMissing ) {
452- missingError = new MissingFieldError (
453- firstMissing ( rawMissing ) ! ,
454- rawMissing ,
443+ if ( includeMissing ) {
444+ missingError || = new MissingFieldError (
445+ firstMissing ( missing ) ! ,
446+ missing ,
455447 query ,
456448 variables
457449 ) ;
0 commit comments