Hi Sven,
I can confirm that the reported problem can be solved by using property
models. For the archive, I have added the solution to the gist:
https://gist.github.com/jmewes/d0fece6d52b3d35743e9952294aba143#file-solution-java
I am happy to see that the problem was caused by my limited
understanding and not a limitation of Wicket itself. So I have no
interest in the requested framework behavior change anymore.
Thanks for your attention and help!
Kind regards,
Jan
Am 04.01.20 um 21:43 schrieb Sven Meier:
Hi Jan,
your labels hold stale data:
Label statusLabel = new Label("status", rowData.getStatus());
When you remove the page id from the url, a new page and label is
instantiated, thus showing new data.
But actually you should use models to bind data to your components:
https://ci.apache.org/projects/wicket/guide/8.x/single.html#_propertymodel
This way re-rendering of the page will always show up-to-date data.
Have fun
Sven
On 04.01.20 18:49, Jan Mewes wrote:
Hi Sven,
Thanks for your reply.
Here is a 12 second recording for the described scenario:
https://www.youtube.com/watch?v=_iL9DeChORU
It shows that the page is re-rendered after the reload but due to the
page version with outdated data for the order status. When the page
version is removed, it picks up the new data from the database an
everything is fine.
Here is an extract of the relevant Wicket code for this scenario:
https://gist.github.com/jmewes/d0fece6d52b3d35743e9952294aba143#file-laborderpanel-java-L45-L49
After reading the discussion thread related to Martin's
"single-page-instance" repository, I came to the conclusion that it
is not possible to disable this behavior without providing a custom
"MountedMapper" which feels too difficult for me.
Kind regards,
Jan
Am 04.01.20 um 17:46 schrieb Sven Meier:
Hi Jan,
>Given a table which displays the state of laboratory orders,
>When an order is canceled via a click on an AJAX button,
>And the page is reloaded via Ctrl + R,
>Then the order is again displayed with status "open".
the page is re-rendered on each reload. So there's no reason why the
status should be shown "open" again.
Except your code keeps hold of stale information.
Furthermore Wicket pages are never cached by the browser (maybe this
was different in 2010?).
So we could discuss page versioning, but maybe we could first check
what problem you're actually trying to solve.
Regards
Sven
On 04.01.20 16:58, Jan Mewes wrote:
Hi,
Given a table which displays the state of laboratory orders,
When an order is canceled via a click on an AJAX button,
And the page is reloaded via Ctrl + R,
Then the order is again displayed with status "open".
I am concerned that this sort of behavior could lead to error
states. I would feel better if there would not be any way to get
back to the old state, i.e. that the ?pageId in the url should be
removed for pages using AJAX.
I tried to achieve this in the following ways but failed:
Disable the versioning by calling the
method/Page#//setVersioned(false):/
https://ci.apache.org/projects/wicket/guide/8.x/single.html#_turning_off_page_versioning
Providing a custom "MountedMapper" as show here and mentioned in
the corresponding conversation:
https://github.com/martin-g/single-page-instance
Setting cache control headers to force a page reload:
https://www.richardnichols.net/2010/03/apache-wicket-force-page-reload-to-fix-ajax-back/
Is there any chance that the disabling of page versioning could
become a first-class feature?
Kind regards,
Jan