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

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

ok, so i found the commit message for this change:

Revision: 572505
Author: ivaynberg
Date: 9/3/07 9:03 PM
Comment:
clear cached item count before render. this value might be cached before render 
is started - for example when visibility of something is checked and 
getitemscount() is called - but the items might change between then and render 
time so it is not safe to cache it during that time period

and now i more clearly remember what happened. a user overrode isvisible() { 
return getrowcount()>0; }. when wicket processes a callback it makes sure that 
the component and its hierarchy is visible all the way up to the page (security 
check, you shouldnt be able to click a link that is not visible...), which 
involves calling isivisible() on each member of the hierarchy, which in turn 
caused the item count to be cached incorrectly.

the safest and simplest solution was to always clear the cache in 
onbeforerender(). now, i do not believe there is anything in wicket itself that 
will cause the size to be loaded before onbeforerender() is called, unless you 
do it yourself by overriding something like isvisible() and doing something in 
there that causes the size to be queried.

does this clear things up a bit?

> 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
>
> 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