Done: http://github.com/dpp/liftweb/issues/#issue/164
Thanks David, -Ross On Nov 5, 2009, at 6:24 PM, David Pollak wrote: > Please open a ticket for this issue. I may have broken it when I > was addressing some other issues related to JSON in the last few > weeks. > > On Thu, Nov 5, 2009 at 3:18 PM, Ross Mellgren <dri...@gmail.com> > wrote: > > Hey all, > > I had some code working where the snippet generates a JSON > callback > which uses S.notice / S.error to push notifications back to the > browser in addition to whatever JS commands the snippet decides to > push down, but it seems that this is now broken in 1.1-SNAPSHOT and > 1.1-M7. I can confirm that just after I call S.notice within the > jsonCall that S.getNotices has the proper thing in it, but by the time > LiftRules.noticesToJsCmd gets called it has vanished. > > A quick survey makes me think that the only way this could happen is > if the RequestVars are getting cleared between the two points, but I > don't want to speculate too hard. > > I've created a modified lift-archetype-blank that demonstrates the > behavior at http://www.github.com/dridus/test-missing-notices -- here > is a overview of the code: > > In template: > > <lift:surround with="default" at="content"> > <lift:helloWorld.callback /> > > <h2>Welcome to your project!</h2> > <p> > </p> > > <lift:Msgs /> > > <button onclick="testCallback()">Click me</button> > > </lift:surround> > > In Boot: > > val oldNoticesToJsCmd = LiftRules.noticesToJsCmd > > LiftRules.noticesToJsCmd = () => { > println("at noticesToJsCmd: S.getNotices = " + > S.getNotices) > oldNoticesToJsCmd() > } > > In snippet: > > class HelloWorld extends DispatchSnippet { > val dispatch: DispatchIt = { > case "callback" => renderCallback _ > } > > def renderCallback(ns: NodeSeq): NodeSeq = { > S.notice("this is the test notice from the snippet") > <head>{ Script { > Function("testCallback", Nil, jsonCall(JsNull, (_: Any) > => { > S.notice("this is the test notice from the callback") > println("in callback: S.getNotices = " + S.getNotices) > Noop > })._2) > } }</head> > } > } > > The output from this on the command line is: > > INFO - Service request (GET) / took 570 Milliseconds > INFO - Service request (GET) /classpath/jquery.js took 15 Milliseconds > INFO - Service request (GET) /ajax_request/liftAjax.js took 8 > Milliseconds > in callback: S.getNotices = List((net.liftweb.http.NoticeType(0),this > is the test notice from the snippet,Empty), > (net.liftweb.http.NoticeType(0),this is the test notice from the > callback,Empty)) > at noticesToJsCmd: S.getNotices = List() > INFO - Service request (POST) /ajax_request/F1007892194776GPS/ took 59 > Milliseconds > > And no notice appears. > > Is there anything I'm doing wrong or that I can do to help diagnose > this further? I really need this kind of behavior to work :-/ > > Thanks in advance, > -Ross > > > > > > > -- > Lift, the simply functional web framework http://liftweb.net > Beginning Scala http://www.apress.com/book/view/1430219890 > Follow me: http://twitter.com/dpp > Surf the harmonics > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---