[ 
https://issues.apache.org/jira/browse/WICKET-1766?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12619762#action_12619762
 ] 

Igor Vaynberg commented on WICKET-1766:
---------------------------------------

the detach is called twice because a callback(onclick) is invoked. this happens 
because inside onclick it is possible to modify the data of the table and thus 
size can become incorrect.

consider this situation:

1. size is called and cached
2. onclick called
  2.1 row added to the database
3. size cache is cleared
4. size is accessed and cached again during table render
5. table redrawn

when step 5 completes the new row will be missing because datatable has cached 
size() before step 2 added the new row.

step 1 is also unavoidable because it is involved in such things as security 
checks of the onclick handler, etc.

i am writing this from memory, but i remember we added step 3 explicitly 
because caching size before onclick was causing this exact problem.


> Method size() of a data provider is invoked twice.
> --------------------------------------------------
>
>                 Key: WICKET-1766
>                 URL: https://issues.apache.org/jira/browse/WICKET-1766
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.4
>         Environment: Ubuntu
>            Reporter: Rik van der Kleij
>            Assignee: Igor Vaynberg
>            Priority: Minor
>             Fix For: 1.3.5
>
>
> Method size() of a data provider is invoked twice during one request. This 
> happens when navigating to a next or latest page in a data table. During 
> debugging I noticed that the onDetach() of AbstractPageableView is invoked an 
> extra time. Implementations of size() normally query the database so it will 
> slow down the performance.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to