Skip to content

NG0951 thrown when deleting a custom interactor resource #231

Description

@adamjohnwright

Deleting a resource added through the custom interactor dialog throws an Angular
runtime error into the console. The list and the diagram end up correct — the
assertion that fails is the one checking nothing threw on the way.

Caught by e2e/custom-interactor-dialog.spec.ts:269, "Deleting a resource you
added › removes it from the diagram, not just from the list":

Error: without throwing on the way out

expect(received).toEqual(expected)
- Array []
+ Array [
+   "RuntimeError: NG0951: Child query result is required but no value is available."
+ ]

What it is

NG0951 means a viewChild.required() / contentChild.required() was read while
its target was not in the view. Something is reading a required query during the
teardown that deleting a resource causes.

What it is not

  • Not viewport.component.ts:212 (interactors = viewChild.required(InteractorsComponent))
    as far as I can tell — cr-interactors is not inside a conditional block. It is
    always rendered and merely hidden with [style.display], so that query has a
    value throughout.
  • Not caused by the e2e fixture work; it reproduces during recording against a
    live backend.

The remaining required queries are listed by
grep -rn "viewChild.required" projects/pathway-browser/src/app/ — the ones worth
looking at first are those in components that appear and disappear with the
interactors panel, since deletion is what triggers it.

Why it matters

It is a thrown error on an action a curator will take. The visible behaviour is
currently correct, which makes it the kind of thing that gets dismissed as noise
until it becomes a real failure after an unrelated change — a required query with
no value is one refactor away from breaking the panel outright.

The test asserting "nothing threw" is doing exactly its job here; the value of
that assertion is that it fails while the symptom is still invisible.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions