You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Pedro Santos (JIRA)" <ji...@apache.org> on 2011/06/22 17:54:47 UTC

[jira] [Created] (WICKET-3827) Component loses state after replace another one

Component loses state after replace another one
-----------------------------------------------

                 Key: WICKET-3827
                 URL: https://issues.apache.org/jira/browse/WICKET-3827
             Project: Wicket
          Issue Type: Bug
          Components: wicket-core
    Affects Versions: 1.5-RC4
            Reporter: Pedro Santos


After WICKET-3197 we set the replacement component 'output markup id' flag to be the same as the replaced component [1]. IMO we can't change the component state set by users in benefit of the component being replaced as it can lead to unexpected behaviors like AJAX links or buttons not working. I'm sending a quickstart to exemplify.

1- Component#setMarkupId(Component comp)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-3827) Component loses state after replace another one

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13054018#comment-13054018 ] 

Martin Grigorov commented on WICKET-3827:
-----------------------------------------

Why ID6 ? The markupId is transferred with the previous two lines. Just the 'outputMarkup' flag is not transferred, but trying to add it to ART will tell you immediately that you need to set it explicitly.
In 1.4 it behaves the same way.

> Component loses state after replace another one
> -----------------------------------------------
>
>                 Key: WICKET-3827
>                 URL: https://issues.apache.org/jira/browse/WICKET-3827
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC4
>            Reporter: Pedro Santos
>         Attachments: WICKET-3827-markup-id.zip
>
>
> After WICKET-3197 we set the replacement component 'output markup id' flag to be the same as the replaced component [1]. IMO we can't change the component state set by users in benefit of the component being replaced as it can lead to unexpected behaviors like AJAX links or buttons not working. I'm sending a quickstart to exemplify.
> 1- Component#setMarkupId(Component comp)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (WICKET-3827) Component loses state after replace another one

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-3827.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5-RC6

> Component loses state after replace another one
> -----------------------------------------------
>
>                 Key: WICKET-3827
>                 URL: https://issues.apache.org/jira/browse/WICKET-3827
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC4
>            Reporter: Pedro Santos
>            Assignee: Igor Vaynberg
>             Fix For: 1.5-RC6
>
>         Attachments: WICKET-3827-markup-id.zip
>
>
> After WICKET-3197 we set the replacement component 'output markup id' flag to be the same as the replaced component [1]. IMO we can't change the component state set by users in benefit of the component being replaced as it can lead to unexpected behaviors like AJAX links or buttons not working. I'm sending a quickstart to exemplify.
> 1- Component#setMarkupId(Component comp)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-3827) Component loses state after replace another one

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13053976#comment-13053976 ] 

Igor Vaynberg commented on WICKET-3827:
---------------------------------------

i do not think it is safe

suppose

class Page {
  Component foo;

  public Page() {
    add(foo=new Label("foo").setOutputMarkupId(true);
    add(new ajaxlink("link") { onclick(target) { Label bar=new Label(foo.getid()).setOutputMarkupId(true); foo.replaceWith(bar); foo=bar; target.add(foo);  }}

this simple case will fail to work

first foo is created with an autogenerated unique id ID0, it is rendered <div id="ID0">
next we create bar which gets a newly generated id ID6. we replace foo with bar and add bar to the ajax request target. this will fail because wicket will be looking for a node with ID6 and will not find it. this is why the code is there - to keep this from happening.

> Component loses state after replace another one
> -----------------------------------------------
>
>                 Key: WICKET-3827
>                 URL: https://issues.apache.org/jira/browse/WICKET-3827
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC4
>            Reporter: Pedro Santos
>         Attachments: WICKET-3827-markup-id.zip
>
>
> After WICKET-3197 we set the replacement component 'output markup id' flag to be the same as the replaced component [1]. IMO we can't change the component state set by users in benefit of the component being replaced as it can lead to unexpected behaviors like AJAX links or buttons not working. I'm sending a quickstart to exemplify.
> 1- Component#setMarkupId(Component comp)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-3827) Component loses state after replace another one

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13054044#comment-13054044 ] 

Pedro Santos commented on WICKET-3827:
--------------------------------------

+1 Martin's patch, it's the same change I did here and my project is working fine so far.
@Igor the markup id persistence between replacements remains untouched, just transfering others states than id are problematic since we are overriding the user's component setup.

> Component loses state after replace another one
> -----------------------------------------------
>
>                 Key: WICKET-3827
>                 URL: https://issues.apache.org/jira/browse/WICKET-3827
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC4
>            Reporter: Pedro Santos
>            Assignee: Igor Vaynberg
>             Fix For: 1.5-RC6
>
>         Attachments: WICKET-3827-markup-id.zip
>
>
> After WICKET-3197 we set the replacement component 'output markup id' flag to be the same as the replaced component [1]. IMO we can't change the component state set by users in benefit of the component being replaced as it can lead to unexpected behaviors like AJAX links or buttons not working. I'm sending a quickstart to exemplify.
> 1- Component#setMarkupId(Component comp)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (WICKET-3827) Component loses state after replace another one

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg reassigned WICKET-3827:
-------------------------------------

    Assignee: Igor Vaynberg

> Component loses state after replace another one
> -----------------------------------------------
>
>                 Key: WICKET-3827
>                 URL: https://issues.apache.org/jira/browse/WICKET-3827
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC4
>            Reporter: Pedro Santos
>            Assignee: Igor Vaynberg
>         Attachments: WICKET-3827-markup-id.zip
>
>
> After WICKET-3197 we set the replacement component 'output markup id' flag to be the same as the replaced component [1]. IMO we can't change the component state set by users in benefit of the component being replaced as it can lead to unexpected behaviors like AJAX links or buttons not working. I'm sending a quickstart to exemplify.
> 1- Component#setMarkupId(Component comp)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (WICKET-3827) Component loses state after replace another one

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pedro Santos updated WICKET-3827:
---------------------------------

    Comment: was deleted

(was: +1 Martin's patch, it's the same change I did here and my project is working fine so far.
@Igor the markup id persistence between replacements remains untouched, just transfering others states than id are problematic since we are overriding the user's component setup.)

> Component loses state after replace another one
> -----------------------------------------------
>
>                 Key: WICKET-3827
>                 URL: https://issues.apache.org/jira/browse/WICKET-3827
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC4
>            Reporter: Pedro Santos
>            Assignee: Igor Vaynberg
>             Fix For: 1.5-RC6
>
>         Attachments: WICKET-3827-markup-id.zip
>
>
> After WICKET-3197 we set the replacement component 'output markup id' flag to be the same as the replaced component [1]. IMO we can't change the component state set by users in benefit of the component being replaced as it can lead to unexpected behaviors like AJAX links or buttons not working. I'm sending a quickstart to exemplify.
> 1- Component#setMarkupId(Component comp)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-3827) Component loses state after replace another one

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13053871#comment-13053871 ] 

Martin Grigorov commented on WICKET-3827:
-----------------------------------------

--- wicket-core/src/main/java/org/apache/wicket/Component.java	(revision 1138875)
+++ wicket-core/src/main/java/org/apache/wicket/Component.java	(working copy)
@@ -2812,7 +2812,6 @@
 
 		generatedMarkupId = comp.generatedMarkupId;
 		setMetaData(MARKUP_ID_KEY, comp.getMetaData(MARKUP_ID_KEY));
-		setOutputMarkupId(comp.getOutputMarkupId());
 	}

solve it.
All tests pass.
I think it is safe.

> Component loses state after replace another one
> -----------------------------------------------
>
>                 Key: WICKET-3827
>                 URL: https://issues.apache.org/jira/browse/WICKET-3827
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC4
>            Reporter: Pedro Santos
>         Attachments: WICKET-3827-markup-id.zip
>
>
> After WICKET-3197 we set the replacement component 'output markup id' flag to be the same as the replaced component [1]. IMO we can't change the component state set by users in benefit of the component being replaced as it can lead to unexpected behaviors like AJAX links or buttons not working. I'm sending a quickstart to exemplify.
> 1- Component#setMarkupId(Component comp)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (WICKET-3827) Component loses state after replace another one

Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pedro Santos updated WICKET-3827:
---------------------------------

    Attachment: WICKET-3827-markup-id.zip

> Component loses state after replace another one
> -----------------------------------------------
>
>                 Key: WICKET-3827
>                 URL: https://issues.apache.org/jira/browse/WICKET-3827
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC4
>            Reporter: Pedro Santos
>         Attachments: WICKET-3827-markup-id.zip
>
>
> After WICKET-3197 we set the replacement component 'output markup id' flag to be the same as the replaced component [1]. IMO we can't change the component state set by users in benefit of the component being replaced as it can lead to unexpected behaviors like AJAX links or buttons not working. I'm sending a quickstart to exemplify.
> 1- Component#setMarkupId(Component comp)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira