Problem loading css in updateRoot:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem loading css in updateRoot:

jtuchel
Hi,

I tried adding a css file from a WAFileLibrary sublass to only one component, because it is really just needed on pages that use the WAComponent that refernences it. The reason is that if you use #selectorsToInclude on the file library, the css will be imported into every single page. It is a larger css file, and since our production server uses https, I'd like to avoid importing too much.

So I implemented this:

updateRoot: htmlRoot
   
   super updateRoot: htmlRoot.
   htmlRoot stylesheet beCss url: KontolinoFileLibrary / #buaDetailsCss.
 


I either don't understand the purpose of updateRoot: completely or there is some problem with this approach:

In IE 11 and Safari 7.0.4 as well as Firefox 29, the css link is not always in the head-section of the resulting page. But is there if I hit the Browser's reload button on the page. This is quite consistently so, but in maybe 3 out of 25 tries the css is also in the page when I navigate to it by call: or show:

So far I only tried that locally with direct http access to the image (development machine), no front-end http server.

Am I trying to do something at the wrong place - should I use another method for this?
Is this a bug in Seaside? I have only tried in VA Smalltalk so far...

For now, the css is back to #selectorsToInclude.

But I would like to use a technique that allows me to only add js and css files and such on pages that include a certain Component, to reduce load and execution times of complex pages.

Joachim



-- 
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          [hidden email]
Fliederweg 1                         http://www.objektfabrik.de
D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Problem loading css in updateRoot:

Philippe Marschall
On Wed, May 28, 2014 at 9:01 AM, [hidden email]
<[hidden email]> wrote:

> Hi,
>
> I tried adding a css file from a WAFileLibrary sublass to only one
> component, because it is really just needed on pages that use the
> WAComponent that refernences it. The reason is that if you use
> #selectorsToInclude on the file library, the css will be imported into every
> single page. It is a larger css file, and since our production server uses
> https, I'd like to avoid importing too much.
>
> So I implemented this:
>
> updateRoot: htmlRoot
>
>    super updateRoot: htmlRoot.
>    htmlRoot stylesheet beCss url: KontolinoFileLibrary / #buaDetailsCss.

That's implemented in a specific component class of yours?

> I either don't understand the purpose of updateRoot: completely or there is
> some problem with this approach:
>
> In IE 11 and Safari 7.0.4 as well as Firefox 29, the css link is not always
> in the head-section of the resulting page.

The browser should not matter since it's either in the HTML or not.

> But is there if I hit the
> Browser's reload button on the page. This is quite consistently so, but in
> maybe 3 out of 25 tries the css is also in the page when I navigate to it by
> call: or show:
>
> So far I only tried that locally with direct http access to the image
> (development machine), no front-end http server.
>
> Am I trying to do something at the wrong place - should I use another method
> for this?
> Is this a bug in Seaside? I have only tried in VA Smalltalk so far...

Are you using AJAX?

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Problem loading css in updateRoot:

jtuchel
Hi Phillipe,

first of all: thanks for your time!

Am 28.05.14 11:07, schrieb Philippe Marschall:

> On Wed, May 28, 2014 at 9:01 AM, [hidden email]
> <[hidden email]> wrote:
>> Hi,
>>
>> I tried adding a css file from a WAFileLibrary sublass to only one
>> component, because it is really just needed on pages that use the
>> WAComponent that refernences it. The reason is that if you use
>> #selectorsToInclude on the file library, the css will be imported into every
>> single page. It is a larger css file, and since our production server uses
>> https, I'd like to avoid importing too much.
>>
>> So I implemented this:
>>
>> updateRoot: htmlRoot
>>
>>     super updateRoot: htmlRoot.
>>     htmlRoot stylesheet beCss url: KontolinoFileLibrary / #buaDetailsCss.
> That's implemented in a specific component class of yours?
Right. That's in the component which creates html tags with specific
css-classes that are styled in the referenced buaDetailsCss

>
> The browser should not matter since it's either in the HTML or not.
Yes, that's logical.

>> Am I trying to do something at the wrong place - should I use another method
>> for this?
>> Is this a bug in Seaside? I have only tried in VA Smalltalk so far...
> Are you using AJAX?

Yes, the page that contains the component has a number of Ajax calls.
Most of them are only issued on click, keyup/down or blur. I do not use
ajax onLoad or such. So I see no connection here.
In my mind, the same argument as above stands: ajax shouldn't be
important here, the link is either in the <head> or not.

But I guess you have something in mind when you ask that?


Joachim


--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          mailto:[hidden email]
Fliederweg 1                         http://www.objektfabrik.de
D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Problem loading css in updateRoot:

Philippe Marschall
On Wed, May 28, 2014 at 12:01 PM, [hidden email]
<[hidden email]> wrote:

> Hi Phillipe,
>
> first of all: thanks for your time!
>
> Am 28.05.14 11:07, schrieb Philippe Marschall:
>
>> On Wed, May 28, 2014 at 9:01 AM, [hidden email]
>> <[hidden email]> wrote:
>>>
>>> Hi,
>>>
>>> I tried adding a css file from a WAFileLibrary sublass to only one
>>> component, because it is really just needed on pages that use the
>>> WAComponent that refernences it. The reason is that if you use
>>> #selectorsToInclude on the file library, the css will be imported into
>>> every
>>> single page. It is a larger css file, and since our production server
>>> uses
>>> https, I'd like to avoid importing too much.
>>>
>>> So I implemented this:
>>>
>>> updateRoot: htmlRoot
>>>
>>>     super updateRoot: htmlRoot.
>>>     htmlRoot stylesheet beCss url: KontolinoFileLibrary / #buaDetailsCss.
>>
>> That's implemented in a specific component class of yours?
>
> Right. That's in the component which creates html tags with specific
> css-classes that are styled in the referenced buaDetailsCss
>
>
>>
>> The browser should not matter since it's either in the HTML or not.
>
> Yes, that's logical.
>
>
>>> Am I trying to do something at the wrong place - should I use another
>>> method
>>> for this?
>>> Is this a bug in Seaside? I have only tried in VA Smalltalk so far...
>>
>> Are you using AJAX?
>
>
> Yes, the page that contains the component has a number of Ajax calls. Most
> of them are only issued on click, keyup/down or blur. I do not use ajax
> onLoad or such. So I see no connection here.
> In my mind, the same argument as above stands: ajax shouldn't be important
> here, the link is either in the <head> or not.
>
> But I guess you have something in mind when you ask that?

Yes I do. If the component is inserted into to the page using ajax it
does not (can not) update the <head>. If you then do a full page
reload and the component is no longer inserted using ajax but part of
the full page rendering it can update the <head>. Could this be what
is happening in your case?

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Problem loading css in updateRoot:

jtuchel
Am 28.05.14 14:15, schrieb Philippe Marschall:
> But I guess you have something in mind when you ask that?
> Yes I do. If the component is inserted into to the page using ajax it
> does not (can not) update the <head>. If you then do a full page
> reload and the component is no longer inserted using ajax but part of
> the full page rendering it can update the <head>. Could this be what
> is happening in your case?
>
>

Well, not ajax per se, but...

the component is rendered, but initially has a display: none style. It
is made visible in a click handler (no ajax involved here).

But the fact that the style is invisible does sure not mean that the
server doesn't include the link to the head, because the html is
rendered on the server side, right?

Nevertheless, what you say makes perfect sense and is a possible trap. I
guess this can only be learned by suffering through it ;-)

Joachim



--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          mailto:[hidden email]
Fliederweg 1                         http://www.objektfabrik.de
D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Problem loading css in updateRoot:

Philippe Marschall
On Wed, May 28, 2014 at 2:37 PM, [hidden email]
<[hidden email]> wrote:

> Am 28.05.14 14:15, schrieb Philippe Marschall:
>
>> But I guess you have something in mind when you ask that?
>> Yes I do. If the component is inserted into to the page using ajax it
>> does not (can not) update the <head>. If you then do a full page
>> reload and the component is no longer inserted using ajax but part of
>> the full page rendering it can update the <head>. Could this be what
>> is happening in your case?
>>
>>
>
> Well, not ajax per se, but...
>
> the component is rendered, but initially has a display: none style. It is
> made visible in a click handler (no ajax involved here).
>
> But the fact that the style is invisible does sure not mean that the server
> doesn't include the link to the head, because the html is rendered on the
> server side, right?

Correct.

I don't assume you have a simple example to reproduce the issue.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Problem loading css in updateRoot:

jtuchel
Am 28.05.14 14:57, schrieb Philippe Marschall:
> I don't assume you have a simple example to reproduce the issue.
Well, no, but I have a little extra info:

I put a breakpoint into updateRoot: of my component, and it turns out
the method only gets executed at reload, not when the page is initially
rendered... ?

Any ideas?

Joachim


--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          mailto:[hidden email]
Fliederweg 1                         http://www.objektfabrik.de
D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Problem loading css in updateRoot:

Johan Brichau-2
Quick hunch: Is the component a child component and did you define your #children method?
If yes, how? Are the components initialised before rendering or are you instantiating components during rendering (possibly with lazy initialisation)?

Johan

> On 29 May 2014, at 22:40, "[hidden email]" <[hidden email]> wrote:
>
> Am 28.05.14 14:57, schrieb Philippe Marschall:
>> I don't assume you have a simple example to reproduce the issue.
> Well, no, but I have a little extra info:
>
> I put a breakpoint into updateRoot: of my component, and it turns out the method only gets executed at reload, not when the page is initially rendered... ?
>
> Any ideas?
>
> Joachim
>
>
> --
> -----------------------------------------------------------------------
> Objektfabrik Joachim Tuchel          mailto:[hidden email]
> Fliederweg 1                         http://www.objektfabrik.de
> D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
> Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Problem loading css in updateRoot:

jtuchel
Johan,

thanks, you were spot on: in this constellation, the child component was
lazy initialized and therefor not in the updateRoot: chain on first
render, but in consecutive ones.

Thanks Johan and Phillippe for answering!

Great to have you guys on the team ;-)

Joachim


Am 30.05.14 07:48, schrieb Johan Brichau:

> Quick hunch: Is the component a child component and did you define your #children method?
> If yes, how? Are the components initialised before rendering or are you instantiating components during rendering (possibly with lazy initialisation)?
>
> Johan
>
>> On 29 May 2014, at 22:40, "[hidden email]" <[hidden email]> wrote:
>>
>> Am 28.05.14 14:57, schrieb Philippe Marschall:
>>> I don't assume you have a simple example to reproduce the issue.
>> Well, no, but I have a little extra info:
>>
>> I put a breakpoint into updateRoot: of my component, and it turns out the method only gets executed at reload, not when the page is initially rendered... ?
>>
>> Any ideas?
>>
>> Joachim
>>
>>
>> --
>> -----------------------------------------------------------------------
>> Objektfabrik Joachim Tuchel          mailto:[hidden email]
>> Fliederweg 1                         http://www.objektfabrik.de
>> D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
>> Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1
>>
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          mailto:[hidden email]
Fliederweg 1                         http://www.objektfabrik.de
D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside