index() update problem in repeat on nodeset change

RESOLVED FIXED

Status

Core Graveyard
XForms
RESOLVED FIXED
12 years ago
a year ago

People

(Reporter: Aurelian Penciu, Assigned: Allan Beaufour)

Tracking

({fixed1.8.0.5, fixed1.8.1})

Trunk
fixed1.8.0.5, fixed1.8.1
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

3.54 KB, application/xhtml+xml
Details
(Reporter)

Description

12 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20051202 Firefox/1.6a1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20051202 Firefox/1.6a1

The index() of a nested repeat is not set correctly after a random number of insert/delete operations on several nested repeat elements. 

The problem occurs when using nested repeat elements (the nested repeat uses a rather complex XPath expression to filter out items marked as deleted or hidden). 

After several insert/delete cycles (items are inserted in the nested repeat for different outer repeat items), if the user alternates deleting inner items from more than one outer items the index of the nested repeat fails to be set properly (actually it is correct only for one of the nested repeat elements and does not change for the others).

An example to clarify the issue will be provided.  

Reproducible: Sometimes

Steps to Reproduce:
Using the attached test case
1. Click on "Add 10 Items" for each of the four items of the outer repeat element.
2. The middle panel should show the filtered collection while the right panel should show the unfiltered version.
3. Start deleting items (click on Delete) in the following orther:
 - first the last item (10) of Item list#4
 - then the last item (10)  of Item list#3
 - then the last item (10)  of Item list#2
 - then the last item (10)  of Item list#1
 - now delete the last item (9) of Item list#1
 - try to delete the last item (9) of Item list#2 (failed for me)
4. Check the value of the nested repeat index (second value listed in the first panel) and notice that it is not updated when clicking on Delete (as it used to happen until this point).

The problem occurs after other random insert/delete patterns the only commonality seeming to be that operations are performed on several nested repeat  elements.
Actual Results:  
The nested repeat index() is not computed properly after a number of insert/delete  operations. At this point items from the nested repeat elements cannot be referenced properly.

Expected Results:  
Be consistent. Keep setting the index properly.

The problem does not seem to exist on simple xf:repeat elements (or at least it's extremely difficult to reproduce).
(Reporter)

Comment 1

12 years ago
Created attachment 204821 [details]
Testcase

As explained in the bug description.
(Assignee)

Comment 2

12 years ago
Just skimming this, we do not actually handle repeat-index settting on insert/delete properly at all, that's bug 282828. So if you are getting correct behaviour sometimes, consider yourself lucky :) If that is what you are saying, please dupe this bug to 282828. If not, correct me and I will investigate further.
(Reporter)

Comment 3

12 years ago
(In reply to comment #2)
> Just skimming this, we do not actually handle repeat-index settting on
> insert/delete properly at all, that's bug 282828. So if you are getting correct
> behaviour sometimes, consider yourself lucky :) If that is what you are saying,
> please dupe this bug to 282828. If not, correct me and I will investigate
> further.
> 
It's not the ::repeat-index pseudoelement (XForms 1.0 - F.2) that bothers me :-(. The index() function starts failing after "repeated abuse". The "abuse pattern" I managed to reproduce was to have a list of lists (master-detail) and keep inserting/deleting detail items into different masters. 

It looks like it's the fact that I place a delete trigger on each line and I expect that clicking on it would --as a side effect-- set both indices (master and detail) correctly (E.g. clicking on a(2,3) would set the master index to 2 and the detail index to 3). Once in a while it doesn't.

If this is indeed related to the repeat-index bug 282828 or to bug 302922 (I'll try to read the code but it will take some time) please confirm and I will definitely mark this as a duplicate.
(Assignee)

Comment 4

12 years ago
Sorry that it has taken me so darn long to get to this!

(In reply to comment #3)
> (In reply to comment #2)
> > Just skimming this, we do not actually handle repeat-index settting on
> > insert/delete properly at all, that's bug 282828. So if you are getting correct
> > behaviour sometimes, consider yourself lucky :) If that is what you are saying,
> > please dupe this bug to 282828. If not, correct me and I will investigate
> > further.
> > 
> It's not the ::repeat-index pseudoelement (XForms 1.0 - F.2) that bothers me
> :-(. The index() function starts failing after "repeated abuse". The "abuse
> pattern" I managed to reproduce was to have a list of lists (master-detail) and
> keep inserting/deleting detail items into different masters. 
> 
> It looks like it's the fact that I place a delete trigger on each line and I
> expect that clicking on it would --as a side effect-- set both indices (master
> and detail) correctly (E.g. clicking on a(2,3) would set the master index to 2
> and the detail index to 3). Once in a while it doesn't.

Well, relying on insert and delete to set the indexes correctly is exactly what bug 282828 is about. They do not. BUT as far as I can understand, your problem is that the "Delete" buttons suddenly stop working, right?

If that is your problem then your are not hitting bug 282828, because when you click a trigger inside a repeat row, the index should be set to that repeat row because it receives focus, thus eliminating the need for insert/delete to adjust indexes. I'll look into that.
(Assignee)

Comment 5

11 years ago
It's still there. And it does not even have to be nested repeats.
Blocks: 331209
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows XP → All
Hardware: PC → All
Summary: index() problem in nested repeat elements → index() problem in repeat elements
(Assignee)

Comment 6

11 years ago
Created attachment 219009 [details]
Revised testcase
Attachment #204821 - Attachment is obsolete: true
(Assignee)

Updated

11 years ago
Summary: index() problem in repeat elements → index() update problem in repeat on nodeset change
(Assignee)

Updated

11 years ago
Assignee: aaronr → allan
(Assignee)

Updated

11 years ago
Status: NEW → ASSIGNED
(Assignee)

Comment 7

11 years ago
Fixed by bug 334015
Status: ASSIGNED → RESOLVED
Last Resolved: 11 years ago
Depends on: 334015
Resolution: --- → FIXED
Whiteboard: xf-to-branch
(Assignee)

Updated

11 years ago
Keywords: fixed1.8.1
(Assignee)

Updated

11 years ago
Keywords: fixed1.8.0.5
(Assignee)

Updated

11 years ago
Whiteboard: xf-to-branch
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.