[Fix] Ensure nested repeats are shown when relevance is true#807
[Fix] Ensure nested repeats are shown when relevance is true#807eyelidlessness wants to merge 2 commits intoenketo:masterfrom
Conversation
|
Thanks for tackling a nested repeat issue! I am committing to doing a review. |
| const repeatInfo = getChild( node, `.or-repeat-info[data-name="${p.path}"]` ); | ||
|
|
||
| if ( repeatInfo != null && !getChild( node, `.or-repeat[name="${p.path}"]` ) ) { | ||
| const count = this.form.repeats.updateViewInstancesFromModel( repeatInfo ); |
There was a problem hiding this comment.
I believe the underlying issue is that the first instance of the nested repeat is not created when the top-level repeat (no. 2) is created (after the user clicks the plus button).
The relevant module should not be responsible for fixing that, as it's the responsibility of the repeat module. It's odd that something so elementary is not done correctly. I wonder if this bug was introduced when we started allowing 0 repeat instances. There seems to be some (still mysterious) special condition in the test form, because in e.g. http://localhost:8005/?xform=nested_repeats.xml the bug doesn't surface.
There was a problem hiding this comment.
I was hesitant to apply this fix here too, I'm glad you agree. To be honest I chose this path because I struggled to understand the repeat initialization flow and wasn't sure how to address it there. But I'll take another look because I agree it would be better solved there.
Fixes enketo/enketo#103. This is branched off of master, unlike #806 which we should likely close.
Some of these tests are likely redundant, but it was hard for me to be sure, so I felt more comfortable adding them.