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

Kamil edited comment on WICKET-6507 at 12/17/17 8:31 PM:
---------------------------------------------------------

[~bitstorm], of course in our real app we have correct version of 
"modelChanged" called (the one from AbstractWindow). This "bug" was introduced 
during preparation of this "quickstart" and final effect was identical to the 
real problem, so I thought it was the cause.

But the real problem lies in line:
{code}
new 
FeedbackCollector(form).collect().stream().forEach(FeedbackMessage::markRendered);
{code}

I read Javadoc more carefully and I spotted that despite I'm creating the 
FeedbackCollector explicitly using Component "form"
{code}
new FeedbackCollector(form)
{code}
the 
{code}
includeSession
{code}
is set to true, which I is not so obvious. 

Do you think that maybe more reasonable approach would be:
1) If one is creating FeedbackCollector using no argument constructor it sets 
includeSession to true (as it is now)
2) If one is creating FeedbackCollector using the constructor with specific 
component, includeSession should be set to false by default
3) You could add additional constructor that takes both: specific Component and 
includeSession flag

What do you think about it?


was (Author: eximius):
[~bitstorm], of course in our real app we have correct version of 
"modelChanged" called (the one from AbstractWindow). This "bug" was introduced 
during preparation of this "quickstart" and final effect was identical to the 
real problem, so I thought it was the cause.

But the real problem lies in line:
{code}
new 
FeedbackCollector(form).collect().stream().forEach(FeedbackMessage::markRendered);
{code}

Would you be so kind, and look at it again using this version of "onSubmit":
{code}
@Override
protected void onSubmit(final AjaxRequestTarget target) {
      AbstractWindow.this.onSubmit(target);
      AbstractWindow.this.modelChanged();
      close(target);
}
{code}

and see what happens when you comment/uncomment FeedbackCollector line?

Thank you in advance.

> FeedbackCollector clears JS events
> ----------------------------------
>
>                 Key: WICKET-6507
>                 URL: https://issues.apache.org/jira/browse/WICKET-6507
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 8.0.0-M8
>            Reporter: Kamil
>            Assignee: Andrea Del Bene
>         Attachments: wicket race condition.gif, wicket race condition.mp4, 
> wicket-race-condition-quickstart.zip
>
>
> This bug is weird, but it has probably something to do with race condition.
> I recorded a screencast, so you can clearly see what is wrong.
> When I have some computation directly in "onSubmit" method, then JS alert is 
> invoked properly. If I try to move computation somewhere else (here I just do 
> "extract method" refactoring, but in real life this operation would be 
> executed in some top-level panel or service) then JS is not being invoked 
> (good thing: this behavior is consistent across all of my tries)!
> I attached quickstart so you can try it by yourself. The lines I'm extracting 
> are: AbstractWindow#55



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to