Hi,

While trying to debug an AIOOBE that happens when a user opened the same page in multiple tabs (the page renders a repeater where users can remove items by clicking a button), I came across some interesting behaviour.

I created a tiny example project to show it: https://github.com/toby1984/wicket-ajaxtest

Observations:

1.) When you click on the very first button you notice that the AJAX response contains exactly the same same markup that is already present (so the page doesn't change) 2.) When you continue clicking on the buttons you will get an AIOOBE (caused by ListItemModel.java:61) while trying to delete the last item

These issues go away when I explicitly call detach() on the repeater's model after removing an item from the underlying list like so:

----->8---------->8---------->8---------->8---------->8---------->8---------->8-----
final AjaxButton delete = new AjaxButton("deleteButton",item.getModel())
                {
                    @Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form)
                    {
                        final String obj = getModelObject();
                        db.remove( obj );
                        listModel.detach();
                        target.add( container );
                    }
                };
----->8---------->8---------->8---------->8---------->8---------->8---------->8-----

Is there a way to have this working properly without having to manually detach() after mutating the repeater model's list or is this the recommended approach ?

Thanks,
Tobias




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to