Hi,
has anyone investigated or built a way to support tabbed browsing when
there is considerable view/workflow state? Or have I missed an elegant
way for this to be done in Lift?
If I am not mistaken, Lift currently supports
1. Sending continuations (things that will need to be done) from one
Request to the next in the form of FuncHolders that are attached to an
ID that is unique for a sent page. This works perfectly in a tabbed
environment, and you can send state this way, but the state doesn't
live on in the response sent by the snippet that has received it.
2. Session variables that are global to the session, as well as
3. Stateful snippets that are instantiated at most once in each
session.
When assuming that your user knows how to browse tabbed, I can
currently not imagine what 2. and 3. could be practically useful for.
Very often though, it seems, people use these mechanisms and then
later realize the mess they are in.
E.g. (quite funny)
http://www.highdots.com/forums/javascript/browser-tab-269390.html
More serious:
http://www.codeodor.com/index.cfm/2007/7/19/Why-tabbed-browsing-makes-holding-form-state-with-sessions-obsolete/1470
A simple example from an application I'm developing, and I'll bet more
than half of all Web apps, is this: I have one page where users can
search for a bunch of documents in a database (search form and result
list are on the same page - let's not make it too complicated).
Clicking on a result will navigate to the detail view of a document. I
am sure sooner or later the customer will want a link on the detail
view to go back to the search he came from.
If I put the last search parameters used into Session Vars, this will
not work if the customer uses several such result lists in parallel
(not unrealistic in this case). He will always end up going back to
the last search used, not the one that was used to open the detail
view. Very bad behavior for example when the user has edited an item,
and it then "vanishes" from his view.
What would work is: put the search parameters into hidden fields and/
or URL parameters of the detail view. But you break your fingers doing
that and it gets really messy when the detail view can be opened from
several different context, and the conversation that takes you back to
the original context has several steps. There is also a limit to what
you can put into a URL, I believe. You use a framework because it
saves you these kinds of headaches.
It seems to me, Lift already has 80% of what it takes for a great
solution. It is the mechanism mentioned under 1. Any tab that is still
open calls home regularly to say "I'm still here, don't forget me".
This is good because otherwise we would have to consider any page ever
sent to the client to still be open and come back to haunt us,
demanding us to behave as if nothing had happened since. The existing
mechanism would only need to allow the state to be passed on, with a
delta, to the next response-request episode.