cylc/cylc-ui

subscriptions: root child tasks being requested twice

Closed this issue · 0 comments

  • We request cycle points by requesting families and filtering for the root family.
  • We also request families (no filtering).
  • For all families we request the list of child tasks.

cylc-ui/src/views/Tree.vue

Lines 160 to 182 in 77cbf48

fragment CyclePointData on FamilyProxy {
__typename
id
state
ancestors {
name
}
childTasks {
id
}
}
fragment FamilyProxyData on FamilyProxy {
__typename
id
state
ancestors {
name
}
childTasks {
id
}
}

This means that we are requesting the list of child tasks for the root family twice. Yuck!

Funny thing is, we don't actually need the list of child tasks for the root family in the first place, it can be inferred that a task inherits from root if it doesn't inherit from anything else.

  • We can definitely avoid requesting child tasks for the root families if we are already requesting families (as in the tree view), so there's an easy win there.
  • We can probably avoid requesting child tasks for the root family all together (by inferring inheritance from root in the absence of inheritance from anywhere else).

Requesting the list of child tasks is itself a somewhat icky solution, the reason we ask families what tasks they contain rather than asking tasks what family they belong to is because we can't add a task to a family until we have created the family. With a bit of head scratching we could probably do this the other way around if that would be more efficient.