Skip to content
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

Fix some problems with async rendering #448

Closed
wants to merge 2 commits into from
Closed

Conversation

brianush1
Copy link

@brianush1 brianush1 commented Jul 29, 2019

  • Fixed typo (if (e.async)) that lead to the Or, if you meant to create an async function, pass async: true as an option. message always being shown regardless of the async option.
  • Fixed problem in the __express function where a raw Promise was being passed to express.js when async was enabled, instead of waiting on the Promise to resolve and passing the result to express.

Edit: If anyone is having this problem and would like to fix it, until this gets merged, use:

ejs.__express = (file, options, callback) => {
	if (options.async) {
		ejs.renderFile(file, options, async (err, promise) => {
			callback(err, await promise);
		});
	}
	else {
		ejs.renderFile(file, options, callback);
	}
}

@@ -641,7 +641,7 @@ Template.prototype = {
e.message += ' while compiling ejs\n\n';
e.message += 'If the above error is not helpful, you may want to try EJS-Lint:\n';
e.message += 'https://github.com/RyanZim/EJS-Lint';
if (!e.async) {
if (!opts.async) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already fixed this in #460 (d6376fa).

@mde
Copy link
Owner

mde commented Mar 29, 2020

As @ExE-Boss noted, this is already fixed.

@mde mde closed this Mar 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants