Hi,

I'm having a problem with a ListView that displays an outdated list. In my
test, the ListView uses a LoadableDetachableModel that "loads" from a
static variable just to make sure the model is independent from any page
instance. As far as I can tell, this problem has nothing to do with the
model, but with the way Wicket prepares for a request listener invocation.

The exact setup is this:
- the page contains a ListView and (outside of the list) a Link that adds
an item to the list in its onClick(). The list itself is stored in a static
variable.
- the page is stateless
- the page's components are created in onInitialize()

Result:
The list doesn't show the most recently added item. Reloading the original
page shows the correct list. Note that by "reloading" I mean entering the
page's URL since the browser's address bar now contains the request
listener URL due to the page being stateless.

This is how I think is happens:
- Initially rendering the page works fine. The page is then discarded since
it's stateless.
- Clicking on the link creates a new page instance to invoke the link's
request listener.
- IPageAndComponentProvider.getComponent() cannot find the link yet since
it is not created until onInitialize() has been called.
- as a consequence, it calls page.internalInitialize() and
internalPrepareForRender(false)
- this creates the link, but it also creates the ListView and prepares it
for rendering. This in turn polls the ListView's model and creates list
items. It also marks the ListView as "prepared for render", which is the
crucial point.
- The link's request listener runs and adds an item to the list.
- After the request listener handler, the page render handler runs
- Tha

Reply via email to