Skip to content
Browse files

Fixed SHtml.memoize to not be wacky

  • Loading branch information...
1 parent 547f044 commit c16413f45bdf080d73b0c545b79d64a3abd334be @dpp dpp committed Aug 26, 2011
Showing with 5 additions and 7 deletions.
  1. +5 −7 web/webkit/src/main/scala/net/liftweb/http/SHtml.scala
View
12 web/webkit/src/main/scala/net/liftweb/http/SHtml.scala
@@ -282,17 +282,15 @@ trait SHtml {
* explicitly capture the template
*/
def memoize(f: => NodeSeq => NodeSeq): MemoizeTransform = {
- val salt = (new Exception()).getStackTrace().apply(2).toString
new MemoizeTransform {
- object latestNodeSeq extends RequestVar[NodeSeq](NodeSeq.Empty) {
- override val __nameSalt = salt
- }
- def apply(ns: NodeSeq): NodeSeq = {
- latestNodeSeq.set(ns)
+ private var lastNodeSeq: NodeSeq = NodeSeq.Empty
+
+ def apply(ns: NodeSeq): NodeSeq = {
+ lastNodeSeq = ns
f(ns)
}
- def applyAgain(): NodeSeq = f(latestNodeSeq.get)
+ def applyAgain(): NodeSeq = f(lastNodeSeq)
}
}

0 comments on commit c16413f

Please sign in to comment.
Something went wrong with that request. Please try again.