[Seaside-dev] Decorations are not visited by WARenderVisitor

Johan Brichau johan at inceptive.be
Mon Jun 28 13:56:07 UTC 2021


We should investigate, but I would think your fix is right.
Please send in a PR so we can watch the build.

I will need to discover this myself of the difference was intended or not :-)

Johan

> On 27 Jun 2021, at 00:28, Esteban Maringolo <emaringolo at gmail.com> wrote:
> 
> Hi all,
> 
> I was moving some parts of a Seaside app to be stateless, and session
> independent, so I created a restful handler that directly renders the
> output using a WABuilder, in this way:
> 
> GwWebHandler>>#home
>  <get>
>  <path: '/'>
>  <produces: 'text/html'>
>  | component |
>  component := GwApplicationLayout new.
>  component bodyComponent: (GwApplicationHomeComponent new)
> addContainerDecoration.
>  ^ WAHtmlCanvas builder
>    fullDocument: true;
>    rootBlock: [ :root | component updateRoot: root ];
>    render: [ :html | html render: component ]
> 
> There I add a ContainerDecoration that I use depending on whether the
> body component is embedded or not. But for some reason such decoration
> was not being visited during the rendering (and it was rendered when
> within a regular WAApplication).
> 
> So I noticed that the WARenderingContext used for the WABuilder in the
> above method is set up differently than the one in
> WARenderPhaseContinuation, where in the last one, it sets a
> WARenderingGuide as its visitor (instead of a plain WARenderVisitor).
> 
> The catch is that the WARenderVisitor never goes through the
> decorations, while WAPresenterVisitor delegates in the client (a
> WARenderingGuide) to do it, which it does.
> 
> WAPresenterVisitor>>#visitPainter: aPainter
>  self client visit: aPainter
> 
> WARenderVisitor>>#visitPainter: aPainter
>  | renderer |
>  renderer := aPainter rendererClass context: self renderContext.
>  aPainter renderContentOn: renderer.
>  renderer flush
> 
> Is there a reason for not using a render context configured to use the
> same visitor in both cases?
> 
> I "fixed" it by creating my own subclass of WABuilder and using a
> special method of #render:on: where I set the request context to use
> the same visitor:
> "..."
> context visitor: (WARenderingGuide client: context visitor).
> "..."
> 
> But of course this only works for painters that might have decorators,
> but it seems to be harmless in other types of canvases.
> 
> Best regards!
> 
> ps: I am the only one using Decorators? I found them very useful when
> adding chrome or special presentations such as in this case, wrapping
> them with some css container, otherwise they'll use the full width and
> be ready to be embedded somewhere else.
> 
> Esteban A. Maringolo
> _______________________________________________
> seaside-dev mailing list
> seaside-dev at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev



More information about the seaside-dev mailing list