-
Notifications
You must be signed in to change notification settings - Fork 383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please remove defaultLayout #253
Comments
…always render default view, but the one that was specified to render.
couldn't you just set |
Sure, but we still need this to be fixed since it's a breaking change. |
Yes I can change defaultLayout to null or false or 0 but it is not the use case for default property usage. It should cover all possible properties out of box. So what I mean that why would I specify property that I wouldn't use? If you do then please specify it explicitly. |
I'm having the same problem, but setting Code:
Logs: What am I missing here? |
Ok, I've fixed the issue by setting layout to false at render call:
Please make sure to release a new major version if publishing breaking changes. |
I second @Romick2005 We had a hard time figuring out what's going on after upgrading (safe upgrading because no major version). for example res.status(403).render('403', data) did not work anymore. |
@JSteunou @Romick2005 Yes, I'm with you on this one, I just needed to work around the issue to keep the app running, but I don't think is something I want to leave in the codebase. That said, this raises a question around the general practice of versioning and how packages are consumed, as in my case I didn't explicitly updated anything. For now I decided to remove the In such scenario, how can I protect myself from incidents like this one? I'm quite sure that there was no ill intent in this case and some lesson has been learned by the authors/maintainers, but that doesn't prevent the same incident from happening again in the future, as we are basically trusting package publishers to follow general practice, without any guarantee that they will. Thoughts? Opinions? All feedback is appreciated. BTW: authoring/maintaining open source libraries can be a rough game, so kudos to authors/collaborators! |
The defacto standard is semver in the JS / npm world that means
Of course authoring libraries is tough so the duty is shared : we all need to be aware that mistake can be made and we need to test our upgrade. Even some big guys like the React team can had bugs in new release. At our level we can alert the author and help him fix the bug either by PR, tests, feedbacks, ... then wait :) |
Previously there were no defined defaultLayout and it was ok. But now we have:
function ExpressHandlebars(config) { // Config properties with defaults. utils.assign(this, { handlebars : Handlebars, extname : '.handlebars', layoutsDir : undefined, // Default layouts directory is relative to
express settings.view+
layouts/partialsDir : undefined, // Default partials directory is relative to
express settings.view+
partials/defaultLayout : 'main', helpers : undefined, compilerOptions: undefined, }, config);
That cause not natural behaviour in render view:
`ExpressHandlebars.prototype.renderView = function (viewPath, options, callback) {
...
// Pluck-out ExpressHandlebars-specific options and Handlebars-specific
// rendering options.
options = {
cache : options.cache,
view : view,
layout: 'layout' in options ? options.layout : this.defaultLayout,
...`
The text was updated successfully, but these errors were encountered: