Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Partial layouts not properly reloaded #25

Closed
renaudleo opened this issue Sep 20, 2012 · 13 comments
Closed

Partial layouts not properly reloaded #25

renaudleo opened this issue Sep 20, 2012 · 13 comments

Comments

@renaudleo
Copy link

I followed the first run instructions, wich went quite well. But when I got to the last step, where I was prompted to remove the {{{first-run}}} tag in the footer partial, the partial was not reloaded after the changes I made.

After a bit of messing around, I realized none of the partials were reloaded when I made changes, until I changed something in the main layout file. But again, this doesn't seem to be true all the time. Sometimes, even if I change something in the footer and layout, only changes made in the main layout will be shown when running the site.

I'm currently running the site on localhost:9009 using punch s, with node 0.8.8.

What am I doing wrong?

@laktek
Copy link
Owner

laktek commented Sep 20, 2012

In which OS you are trying? Normally, partials changes should cause to reload the page.

@renaudleo
Copy link
Author

I'm on OS X 10.7.

@laktek
Copy link
Owner

laktek commented Sep 21, 2012

Hmm. weird. I'm also using the same and it seems to work perfectly.

Can you paste the log of a session where you change a partial and then reload a page?

@renaudleo
Copy link
Author

Here it is:

~  punch setup punch_test
Created a new site in punch_test
To get started, run: cd punch_test; punch s
~  cd punch_test; punch s
Started Punch server on port 9009
127.0.0.1 - GET / HTTP/1.1 200 - - 12 ms
127.0.0.1 - GET /css/main.css HTTP/1.1 200 - - 11 ms
127.0.0.1 - GET /css/normalize.css HTTP/1.1 200 - - 14 ms
127.0.0.1 - GET /css/site.css HTTP/1.1 200 - - 13 ms
127.0.0.1 - GET /favicon.ico HTTP/1.1 200 - - 4 ms
127.0.0.1 - GET / HTTP/1.1 200 - - 7 ms
127.0.0.1 - GET /css/normalize.css HTTP/1.1 304 - - 3 ms
127.0.0.1 - GET /css/main.css HTTP/1.1 304 - - 2 ms
127.0.0.1 - GET /css/site.css HTTP/1.1 304 - - 3 ms
127.0.0.1 - GET /favicon.ico HTTP/1.1 200 - - 1 ms
127.0.0.1 - GET / HTTP/1.1 200 - - 6 ms
127.0.0.1 - GET /css/normalize.css HTTP/1.1 304 - - 2 ms
127.0.0.1 - GET /css/main.css HTTP/1.1 304 - - 2 ms
127.0.0.1 - GET /css/site.css HTTP/1.1 304 - - 3 ms
127.0.0.1 - GET /favicon.ico HTTP/1.1 200 - - 2 ms

The first HTTP/1.1 200 is where I just opened localhost:9009 in my browser.

I then removed {{{first-run}}} in _footer.mustache and reloaded the page, where nothing changed.

I then added some text content in _layout.mustache and reloaded the page. My new content was there, but the first run was still there too.

@laktek
Copy link
Owner

laktek commented Sep 21, 2012

Can you try adding some other content in to _footer.mustache and see whether those get picked up?

I'm still unable to recreate the issue at this end.

@jbourassa
Copy link

That's weird - I got the same problem here. I'll try to debug and I'll report back.

@laktek
Copy link
Owner

laktek commented Sep 26, 2012

@jbourassa Please let me know if you were able to regenerate the issue.

@jbourassa
Copy link

@laktek If by "regenerate" you mean reproduce, yes I can. For what it's worth, I work with @renaudleo so our environments are very similar.

@jbourassa
Copy link

@laktek Also, we're using CLI tools instead of XCode. Shrug.

@prathe
Copy link
Contributor

prathe commented Sep 26, 2012

Is it expected that on a request, the server will regenerate the partials if they have changed with the following options?

  "server": { 
    "cache" : {
      "directives": ["public"]
    }
  }

Or do we need to have something like the following options if we want that behavior?

  "server": { 
    "cache" : {
      "directives": ["no-cache", "no-store"]
    }
  }

In both case, I have to kill the server then restart it and then only save the mustache file in order to see my change. If I want to make another change, I have to kill and restart to server again, and then save the file in order that a request to the server will regenerate the index.html file.

@laktek
Copy link
Owner

laktek commented Sep 26, 2012

@jbourassa It should work fine in CLI (actually, that's how it was intended to use).

@prathe Cache directive should have no effect, because the max-age is set to 0 by default. So even when the caching is enabled, it should reflect the changes on a reload.

The partials are detected as changed by their last modified time attribute. Can you check whether the OS/editor, sets the modified time correctly when you save the file?

@jbourassa
Copy link

@laktek Ok, I figured it out. The cache in Mustache 0.7 is not being updated in properly, and it's fixed in HEAD. The issue is #257.

I see two ways of fixing this, use whichever you like best :

  • "mustache": "0.6"
  • "mustache": "git://github.com/janl/mustache.js.git#6bbc85fe26bc584fb215f2fdb63cabb79c0a03a8"

Yay :)

prathe added a commit to prathe/punch that referenced this issue Sep 27, 2012
which is related to janl/mustache.js#257. Thanks to @jbourassa for
digging this.
laktek added a commit that referenced this issue Sep 27, 2012
Restrict mustache version. Fix #25 which is related to janl/mustache.js#257. Thanks to @jbourassa for digging this.
@laktek
Copy link
Owner

laktek commented Sep 27, 2012

Thanks guys for digging into this issue and finding the solution. I've released a new version, which contains @prathe's update for the Mustache version.

@laktek laktek closed this as completed Sep 27, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants