Skip to content

Expand graph cycles to include self-referential nodes #913

Description

@garethbowen

In #891 we introduced detection of graph cycles based on how JavaRosa does it, which is great. However it misses the case where a field refers to itself, supposedly because JR isn't reactive in the same way as WF so the calculation only fires once. However this is still an invalid form with an undefined behaviour, so the fact that JR handles it is more luck rather than good design.

A simple example, exercised in this test, is...

<bind nodeset="/data/group/a" type="int" calculate="../a + 1" />

In WF this causes an infinite loop. In JR this only appends a single "1" after the user input is complete (not tested).

A more complicated example is #909 where an itemlist updates from its own selection. The solution for this one was to catch 100 iterations and silently stop updating.

Currently we have three different approaches.

  1. Forms with cycles break while filling questions #891 rejects the form on load in both WF and JR.
  2. The simple example above loops for ages then rejects form load on WF, but loads on JR.
  3. Crash after clicking on a checkbox #909 loads the form on both WF and JR.

Figure out the right approach and apply this to all three examples, to standardise the code and user experience.

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

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions