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

Reloadable templates #139

Open
janko opened this issue Feb 21, 2020 · 4 comments
Open

Reloadable templates #139

janko opened this issue Feb 21, 2020 · 4 comments

Comments

@janko
Copy link

janko commented Feb 21, 2020

dry-view currently seems to cache templates, as I don't see the changes being picked up before I restart the server. This is different to how e.g. Roda's rendering works, where templates are not cached but read from the filesystem each time, enabling changes to be picked up.

In development I would like templates to be reloadable, and it seems that none of the code reloaders suggested in the Roda README would help. I don't like the user experience of rerun and shotgun (suggested in #134), I would like to use one of the in-app reloaders that don't restart the whole web server.

Examples

Something like

class MyView < Dry::View
  config.cache = false
end

I would even have it enabled by default, so that correct behaviour is guaranteed in development, and recommend caching for production, but that's just me 😃

Resources

https://github.com/jeremyevans/roda#code-reloading

@timriley
Copy link
Member

I'm open to this idea, @janko. Iif you grep the codebase for extend Dry::Core::Cache, you'll see we cache actually quite a few different things.

I think we'd probably want to take a unified approach to solving this, e.g. enabling/disabling all caching rather than just templates. Does that seem fair to you?

@graudeejs
Copy link

graudeejs commented Mar 25, 2020

dry-view, zeitwerk, listen + monkeypatch in #134 works pretty well for me (without reloading all app), however I'd be happy If I could remove monkeypatch

@timriley
Copy link
Member

timriley commented Apr 9, 2020

Thanks for reminding us of that approach @graudeejs!

@choallin
Copy link

choallin commented Apr 4, 2022

I stumpled uppoon this issue as well when using dry-view with Roda. The solution in issue #134 worked fine, but I think the documentation should mention that the templates are cached.

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

No branches or pull requests

4 participants