CometActors, multiple uses, "refresh" and "back" buttons

24 views
Skip to first unread message

Andrzej Skalski

unread,
Sep 8, 2015, 7:50:09 AM9/8/15
to Lift
Hi,

I have a large CometActor, let's call it "SuperBrowser" that I use in multiple context. Like "some search parameters hardcoded" or "everything available". For this I have a SuperBrowserSnippet that reads S.attr, deduce the mode and sends proper init messages to new CometActor.

This however has a consequence - reloading the webpage containing the snippet causes the CometActor to reload, loosing all variables inside previous instance (that contained user's search preferences inserted while interacting with CometActor)

On the other hand, re-using the Actor (storing the name in SessionVar and not creating a new one by the snippet when the earlier one is present) creates another problem: if I navigate to a subsite using the CometActor in another context, it will not get reloaded, and thus it will appear in previous, non-matching context.

Is there a way to find out (within the snippet) whether the web-page is being reloaded or not? Or whether the address has changed?

Joe Barnes

unread,
Sep 14, 2015, 1:29:11 PM9/14/15
to Lift
I'm struggling a little to understand your use case, but I'll take a stab at an idea here... what if you used the name of the page as the name of the actor?  That way if you refresh the page, you'll use the same name and get the same comet actor.  Navigating to another page will use a different name and case a new actor.

Joe
Reply all
Reply to author
Forward
0 new messages