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

Async functions #2

Open
groenroos opened this issue Oct 25, 2021 · 1 comment
Open

Async functions #2

groenroos opened this issue Oct 25, 2021 · 1 comment
Labels
bug Unintended behaviour and security vulnerabilities help wanted Issues where help is needed from other contributors

Comments

@groenroos
Copy link
Member

The get function needs to use Promises in order to fetch data from the database, but Pug doesn't seem to support async/await functions out-of-the-box.

Fix it so that the get function can output async data into the template.

@groenroos groenroos added bug Unintended behaviour and security vulnerabilities help wanted Issues where help is needed from other contributors labels Oct 25, 2021
@groenroos
Copy link
Member Author

Without having tested anything, there is a pug-async (which seems to be unmaintained). It's not clear if this would be helpful or not.

There is also the possibility of storing the pending Promises centrally, and only executing the rendered() template function once they have all resolved. This seems a bit more complicated with Pug though, as the tag methods are exposed directly as data vars, since Pug doesn't really have "tags" so to speak.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unintended behaviour and security vulnerabilities help wanted Issues where help is needed from other contributors
Development

No branches or pull requests

1 participant