Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion possible issue with IdMemoize and RequestVar in 2.5-M2
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
pelagic  
View profile  
 More options Oct 24 2012, 5:03 pm
From: pelagic <ventis...@gmail.com>
Date: Wed, 24 Oct 2012 14:03:50 -0700 (PDT)
Local: Wed, Oct 24 2012 5:03 pm
Subject: possible issue with IdMemoize and RequestVar in 2.5-M2

I've been working with 2.5-M2 and noticed an interesting thing with
idMemoize and RequestVars.

I have a snippet like this:

object Count extends RequestVar[Int](0)

object Memoize {

  def incrementCount = {
    val count = Count.is
    Count.set(count + 1)
  }

  def render = {
    "div" #> SHtml.idMemoize(in => {
      "@count *" #> Text(Count.is.toString) &
      "@refresh [onclick]" #> SHtml.ajaxInvoke(() => {
        incrementCount
        in.setHtml()
      })
    })
  }

}

The first time refresh is clicked a 1 is displayed in count, as you would
expect. However, the second time it's clicked a 1 is still displayed, not
what you would expect. The third time it displays a 2. This doesn't happen
in 2.5-M1. Maybe I'm missing something ...

My use case for doing this type of thing is putting the IdMemoizeTransform
into a RequestVar so I can share it across Snippets.

Here is a sample project to run the example:

https://github.com/kaiserpelagic/lift-example


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.