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

Change the {{url}}helper to be synchronous #3961

Closed
ErisDS opened this issue Sep 4, 2014 · 1 comment · Fixed by #4726
Closed

Change the {{url}}helper to be synchronous #3961

ErisDS opened this issue Sep 4, 2014 · 1 comment · Fixed by #4726
Milestone

Comments

@ErisDS
Copy link
Member

ErisDS commented Sep 4, 2014

I'm not 100% on what the options for doing this are, but I think we can achieve it if we're a bit clever.

The main reason why the helper is async, is due to the need to fetch the permalink setting. However, settings are cached meaning that this is normally a synchronous operation anyway. Further still, there should be no need to do this more than one per render of a view, so I'm thinking we could perhaps cache the setting either against the helpers or against express with app.set as part of the setup middleware.

It'd probably be good to do something like this with settings & config that affect rendering: url, permalink, activeTheme, postsPerPage etc. URL can only change on a server restart, and the others require settings to be changed, so we could refresh the caches for these object either based on events (something we've talked about elsewhere) or only change the values if they're not set, or if the current request is an admin request.

Just throwing around some thoughts, but the goal remains simple: make {{url}} a normal helper, rather than an async helper.

Removing the need for async helpers at all is a secondary goal as they're unlikely to ever be supported properly.

@ErisDS
Copy link
Member Author

ErisDS commented Nov 13, 2014

This will be made possible by #4445

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 a pull request may close this issue.

1 participant