Skip to content

{% cache %} compatibility - #1619

Merged
EmilStenstrom merged 6 commits into
django-components:masterfrom
jonathan-s:cache-compatibility
Apr 25, 2026
Merged

EmilStenstrom merged 6 commits into
django-components:masterfrom
jonathan-s:cache-compatibility

Conversation

@jonathan-s

Copy link
Copy Markdown
Contributor

@EmilStenstrom @JuroOravec

One annoyance / issue that I stumbled upon was that you get a key error when using django's template cache. The library should really be compatible with django's template tags.

The approach taken here is that we override django's cache template tag to make it component aware. That way it works for django-components and it will continue to work for normal django stuff.

One commit also renames an e2e test such that you can do pytest tests --ignore-glob='*e2e*' which is quite handy when you want to run all tests that are not e2e.

Checking out b6f7af4 and you will see the tests failing. If you add in cache in the load tag, you will see 1 failing test out of the 3.

Would really appreciate if this could be patched in :)

@github-actions

Copy link
Copy Markdown
Contributor

Performance Benchmark Results

Comparing PR changes against master branch:

Benchmarks that have stayed the same:

Change Before [28930c2] After [c2e78e4] Ratio Benchmark (Parameter)
58.8±1ms 58.1±1ms 0.99 Components vs Django.timeraw_render_lg_first('django')
214±4ms 215±4ms 1 Components vs Django.timeraw_render_lg_first('django-components')

@github-actions

Copy link
Copy Markdown
Contributor

Performance Benchmark Results

Comparing PR changes against master branch:

Benchmarks that have stayed the same:

Change Before [28930c2] After [c9ab8e0] Ratio Benchmark (Parameter)
71.1±0.4ms 71.2±1ms 1 Components vs Django.timeraw_render_lg_first('django')
254±3ms 259±5ms 1.02 Components vs Django.timeraw_render_lg_first('django-components')

@github-actions

Copy link
Copy Markdown
Contributor

Performance Benchmark Results

Comparing PR changes against master branch:

Benchmarks that have stayed the same:

Change Before [28930c2] After [a6c1dbc] Ratio Benchmark (Parameter)
47.0±0.3ms 46.9±0.5ms 1 Components vs Django.timeraw_render_lg_first('django')
169±1ms 171±2ms 1.01 Components vs Django.timeraw_render_lg_first('django-components')

@EmilStenstrom
EmilStenstrom merged commit 95044c1 into django-components:master Apr 25, 2026
15 checks passed
@jonathan-s

Copy link
Copy Markdown
Contributor Author

@EmilStenstrom Thanks a lot!

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.

2 participants