Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-2566

RenderInformals mixin does not work with inherited informal parameters

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.4.1
    • Fix Version/s: None
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      It seems like the informal parameters are not propagated to the mixin, if they are inherited. Explicitly rendering the informals instead works.

      The following example illustrates the issue:

      Page.tml
      ...
      <t1 inheritedInformal="inheritedInformal"/>
      ...
      
      T1.java
      @SupportsInformalParameters
      public class T1
      {
          @Component( inheritInformalParameters = true )
          private T2 t2;
      }
      
      T1.tml
      <div xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd">
      <t:content>
          <span t1="t1">
              <span t:id="t2"/>
          </span>
      </t:content>
      </div>
      
      T2.java
      public class T2
      {
          @Mixin
          private RenderInformals renderInformals;  // Does not work like expected
      
          @BeginRender
          void begin( MarkupWriter writer )
          {
              writer.element( "span", "t2", "t2" );
              // resources.renderInformalParameters( writer ); // Works like expected
          }
      
          @AfterRender
          void after( MarkupWriter writer )
          {
              writer.end();
          }
      
          @Inject
          private ComponentResources resources;
      }
      

      The expected output should be:

      <span t1="t1">
        <span inheritedinformal="inheritedInformal" t2="t2"></span>
      </span>
      

      But the produced output is:

      <span t1="t1">
        <span t2="t2"></span>
      </span>
      

      The problem have arisen because we wrap the tapestry Radio component (which uses the RenderInformals mixin)

      A workaround could be to use the RenderNotification plugin and explicitly render the informals in the parent component (T1 in the sample) - but that is not really a nice "solution" (or expected behavior)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              chrispoulsen Chris Poulsen
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: