Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inserting iteration before causes "illegal state when comparing controls" #4035

Closed
ebruchez opened this issue Apr 24, 2019 · 5 comments

Comments

1 participant
@ebruchez
Copy link
Collaborator

commented Apr 24, 2019

Steps:

  • form with a top-level repeated section containing a collapsed nested section
  • insert new iteration above
  • server error

Found when testing #4011.

@ebruchez ebruchez self-assigned this Apr 24, 2019

@ebruchez ebruchez added this to Todo in Orbeon Forms 2018.1.4 via automation Apr 24, 2019

@ebruchez ebruchez added this to To review in Orbeon Forms 2019.1 via automation Apr 24, 2019

@ebruchez ebruchez added this to To do in Orbeon Forms 2018.2.3 via automation Apr 24, 2019

@ebruchez

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 24, 2019

The cause must be that in the first iteration, a section component is collapsed and some content is missing the control tree, as excepted. Then, comparing with the new first iteration, the number of children is different, causing the failure of the assertion.

@ebruchez

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 24, 2019

Steps with this simple form:

  • expand "Nested 2"
  • insert above

Also set:

<property 
    as="xs:integer" 
    name="oxf.fb.section.close"
    value="1"/>
@ebruchez

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 24, 2019

We go from 1 to 3 children of section fb≡top-level-section-section≡xf-38≡nested2-section≡nested3-section⊙1 in this case. This is where the assert fails.

In this case, there is not a structural change. We are comparing unrelated iterations. So we need to trigger full updates here as well.

@ebruchez

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 24, 2019

To repro with customer form:

  • open section B
  • insert above top-level section

Also set:

<property 
    as="xs:integer" 
    name="oxf.fb.section.close"
    value="1"/>
@ebruchez

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 24, 2019

The lowdown is that when comparing repeats, and when iterations are moved, there is a chance that the two sides we are comparing for a given iteration position contain components with lazy bindings whose content is not compatible. If the components have changed structurally, we catch that and produce a full update. But the components might not have changed structurally when iterations move. So we must catch that case too.

How do we detect this? One possibility is that the number of their children has changed, and that is a valid case, but it is not the only one. If hasStructuralChange == false, the only possibility is that the control has changed relevance. So we can check on that.

@ebruchez ebruchez closed this in 79aed97 Apr 25, 2019

Orbeon Forms 2019.1 automation moved this from To review to Done Apr 25, 2019

Orbeon Forms 2018.1.4 automation moved this from Todo to Done Apr 25, 2019

Orbeon Forms 2018.2.3 automation moved this from To do to Done Apr 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.