hydra icon indicating copy to clipboard operation
hydra copied to clipboard

Variants: Cannot read property of undefined + Maximum call stack exceeded

Open ondratra opened this issue 3 years ago • 0 comments

During the development of Olympia council mappings, I encountered another problem(s) with variants that might or might not be related to known problems https://github.com/Joystream/hydra/issues/396 or https://github.com/Joystream/hydra/issues/444.

Assuming schema:

# workaround for https://github.com/Joystream/hydra/issues/434
type VariantNone @variant {
  _phantom: Int
}

type ReferendumStageVoting @variant {
  # ...

  startedAtBlock: BigInt!

  # unfortunately this field creates `Maximum call stack size exceeded` when saving electionRound
  #electionRound: ElectionRound!
}

type ReferendumStageRevealing @variant {
  # ...

  startedAtBlock: BigInt!

  intermediateWinners: [ReferendumStageRevealingOptionResult!]!

  # unfortunately this field creates `Maximum call stack size exceeded` when saving electionRound
  #electionRound: ElectionRound!
}

union ReferendumStage = ReferendumStageVoting | ReferendumStageRevealing | VariantNone

type ReferendumStageRevealingOptionResult @entity {
  # ...

  votePower: BigInt!

  referendumStageRevealing: ReferendumStage!

  # unfortunately this field creates `Maximum call stack size exceeded` when saving electionRound
  #electionRound: ElectionRound!
}

type ElectionRound @entity {
  # ...

  cycleId: Int!

  referendumStageVoting: ReferendumStage!
  referendumStageRevealing: ReferendumStage!
}

When trying to use a simple query when at least some related records exist in the database:

electionRounds { id }

an error occurs:

Cannot read property 'intermediateWinnersIds' of undefined

Also, after uncommenting electionRound relations on ReferendumStage* entities/variants, Maximum call stack size exceeded error occurs.

ondratra avatar Dec 12 '21 22:12 ondratra