Skip to content

Option to disable template caching in development #1324

@philipstarkey

Description

@philipstarkey

I see in the v0.140.0 release notes that:

... in v1, each Component will have at most one static template. This static template is cached internally per component class, and reused across renders.

While I understand this for production deployments, when developing, caching the template means that you must have the Django development server reload every time you change a component template. This is comparatively slow for me, and isn't a requirement for any other Django template file outside of django-components.

For now, I've gone back to using get_template_name() to bypass the cache, but that's obviously deprecated. It would be nice if there was a properly supported option for this (even if it's just a global setting) that could be used to turn off this cache. It would massively improve the developer experience.

Note: Given I was initially confused about this and thus others may be too, this is unrelated to the component caching which caches the component for specific inputs. I'm talking about the cache of the template file specified in the template_file attribute - that cache appears to be completely separate to the component cache and is not controllable by the Component.Cache.enabled flag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions