myusuf
myusuf

Reputation: 12240

Sailsjs view caching (bug ?)

I was rendering a view using res.view('layout', {my: 'Object'}).

Peculiar Behaviour:

When I changed the ejs file and refreshed the browser, the change was visible (without server restart).

BUT

If my object contained a truthy value of property cache, like so:

res.view('layout', {my: 'Object', cache: true})

then, I open the view in the browser, all's good. But if I change the ejs file now, the changes do not show in the browser on refresh, unless server is stopped and re-lifted.

Is there any documentation of sailsjs about this that I missed, or is this part of express framework or ejs or is it a bug ?

SailsJs v0.10.5
NodeJs v0.10.33

Upvotes: 1

Views: 486

Answers (1)

sgress454
sgress454

Reputation: 24948

You are activating ejs caching by setting the cache option to true. This is an unfortunate side effect of ejs mixing its view locals and options together. If your intention was to have a view local named cache, you'll have to name it _cache or something. See the ejs docs for a list of all possible options.

Upvotes: 2

Related Questions