Julius interpolation should update when variables' contents change #567

adimit opened this Issue Jul 3, 2013 · 4 comments


None yet

3 participants

adimit commented Jul 3, 2013

I ran into this issue trying to populate a javascript variable with a list of JSON objects. Here's some pseudo-code setup that should easily lead to the expected result:

getHomeR = do
  records ← runDB $ selectList …
  defaultLayout $ do
    $(widgetFile "tableWidget")

And in the widget:

var records = #{toJSON records}; // the Haskell value containing the data.

renderRow = function(jsonObject) { … }
appendRowToTable = function(row) { … }

$(document).ready(function() {
    $.each(records, function(i,v) {

When the contents of the Haskell variable records change between requests, yesod --dev devel doesn't detect this, but instead serves the javascript corresponding to the old contents of the records variable.

There's a more detailed account of the situation in my stackoverflow question.

One of the commenters there indicates that this might be a problem specifically with yesod devel, but I haven't verified that yet.

@snoyberg snoyberg added a commit to yesodweb/shakespeare that referenced this issue Aug 4, 2013
@snoyberg snoyberg Reproducing test case for yesodweb/yesod#567 99a7440
snoyberg commented Aug 4, 2013

I've created a reproducing test case in yesodweb/shakespeare@99a7440. I've determined that this regression was introduced by yesodweb/shakespeare@5ba1366. The issue is that we now cache old contents regardless of the values of the variables.

Pinging @gregwebs, let me see if there's a way to fix this without losing all of the caching.

@snoyberg snoyberg added a commit to yesodweb/shakespeare that referenced this issue Aug 4, 2013
@snoyberg snoyberg Only cache the [Content]s, not the Builders yesodweb/yesod#567 77ddd97
snoyberg commented Aug 4, 2013

OK, I think I've got a fix for this. @gregwebs I'll send you a pull request on shakespeare. Once that's released, I'd like to ask @adimit to go ahead and test this again.

gregwebs commented Aug 4, 2013

thanks for reporting & fixing. I merged the pull request and will release in a bit

@gregwebs gregwebs closed this Aug 4, 2013
adimit commented Aug 18, 2013

I tried out the new release, and it works as expected now. Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment