Skip to content

Commit

Permalink
Fix #3976 "Newly-relevant controls after repeat fail to update"
Browse files Browse the repository at this point in the history
  • Loading branch information
ebruchez committed Mar 8, 2019
1 parent 25a5447 commit eb087b2
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,14 @@ object Controls {

def startVisitControl(control: XFormsControl): Boolean = {

// Increment before the early return as `endVisitControl` always decrements.
// Caused https://github.com/orbeon/orbeon-forms/issues/3976
level += 1

// If this is a new iteration, don't recurse into it
if (newIterationsIds.nonEmpty && control.isInstanceOf[XFormsRepeatIterationControl] && newIterationsIds(control.effectiveId))
return false

level += 1
_visitedCount += 1

// Value of relevance of content before messing with the binding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1574,4 +1574,71 @@
</output>
</test>

<test description="#3976: Newly-relevant controls after repeat fail to update" name="oxf:pipeline">
<input name="config" href="wrap-xforms-state.xpl"/>
<input name="document">
<xh:html>
<xh:head>
<xf:model id="my-model" xxf:xpath-analysis="true">
<xf:instance id="my-instance">
<form>
<show>false</show>
<my-group>
<my-repeat/>
</my-group>
</form>
</xf:instance>
<xf:bind
id="my-group-bind"
ref="my-group"
relevant="../show = 'true'"/>
<xf:setvalue
event="xforms-ready"
ref="show"
value="true()"/>
</xf:model>
</xh:head>
<xh:body>
<xf:group id="my-group" ref="my-group">
<xf:output id="my-output-41" value="41"/>
<xf:repeat id="my-repeat" ref="my-repeat"/>
<xf:output id="my-output-42" value="42"/>
</xf:group>
</xh:body>
</xh:html>

</input>
<output name="response">
<xxf:event-response>
<xxf:dynamic-state>
<dynamic-state>
<instances>
<instance id="my-instance" model-id="my-model">
<form>
<show>true</show>
<my-group>
<my-repeat/>
</my-group>
</form>
</instance>
</instances>
<controls>
<control effective-id="my-repeat" index="1"/>
</controls>
</dynamic-state>
</xxf:dynamic-state>
<xxf:action>
<xxf:control-values>
<xxf:control id="my-output-41">
<xxf:value>41</xxf:value>
</xxf:control>
<xxf:control id="my-output-42">
<xxf:value>42</xxf:value>
</xxf:control>
</xxf:control-values>
</xxf:action>
</xxf:event-response>
</output>
</test>

</group>

0 comments on commit eb087b2

Please sign in to comment.