[Seaside] Never ending poll when rendering periodical

Lukas Renggli renggli at gmail.com
Mon Jul 2 15:09:39 UTC 2007

> Using a periodical with a high decay value sometimes causes a never ending
> poll mechanism. It seems that this depends on the type of brush being
> rendered, I can't find what i'm doing wrong though.

A periodical updater does never stop, unless you tell it to do so or a
full page refresh happens.


> The problem takes pleace where the text is in bold

Most people use plain text mail clients only.

> MyComponent>>renderContentOn:html
>    html div id:'div' with:'some content'.

There seems to be a semicolon missing.

>    (html submitButton)
>         onClick: (html evaluator callback: [:script |
>                 [(Delay forSeconds:10)"Simulate long running process".

At least in Squeak you have to send #wait to the delay to actually start it.

>                   id: (self attributes at: #id);

You should use #ensureId instead.

>                   decay: 1000;

I don't see why you use a decay, because the HTML always changes when
you are rendering a link or form element. A decay of 1000 doesn't make
much sense, that's far too big. Reasonable values are something
between 1 and 2.

>                   asynchronous: true;

This is not necessary, as it is the default.

>                   evalScripts: true;

You only need this one if you are on an old version of Scriptaculous.

> When rendering simple things like this ones, everything works just fine and
> the poll mechanism stops after the long running process has finished (as
> expected)
>          <li>h text:'something..'
>          <li>h radiobutton
>          <li>h submitButton

Actually, it should never stop. It should go on forever.

Have a look at the code of this simple stop watch example. To stop the
timer it is required to call the method 'stop'. In my version of
Scriptaculous this method is oddly missing, so I directly call it. It
is essential that you assign your updater to a global variable, else
you are unable to stop it again.

renderContentOn: html
	html div id: 'time'.
	html submitButton
		onClick: (html periodical
			id: 'time';
			frequency: 1 second;
			assignTo: 'periodical';
			callback: [ :r | r render: (DateAndTime now - (start ifNil: [ start
:= DateAndTime now ])) ]);
		text: 'Start'.
	html submitButton
		onClick: (html periodical
			alias: 'periodical';
			call: 'stop');
		text: 'Stop'

Lukas Renggli

More information about the Seaside mailing list