Releases: wrabit/django-cotton
Releases · wrabit/django-cotton
v1.0.3
v1.0.2 - Fix empty cvars
What's Changed
- Fixed cases where cvars without values were not being overwritten by component attributes
- Added test
Full Changelog: v1.0.1...v1.0.2
v1.0.1 - fixes
What's Changed
- Altered empty cvars handling +
class
attrs by @wrabit in #142 - Introduced average testing by @wrabit in #143
Full Changelog: v1.0.0...v1.0.1
v1.0.0 - Rewrite + Improved Performance
What's Changed
Summary:
- Simplified loader logic, moving cvars logic to templatetags
- Dropped internal requirement for component keys throughout
- Improved component template caching
- Cleaned shared responsibility of slot tag and created new internal tag - 'attr' to handle attribute expressions
- Simplified context handling, now keep all cotton related state in own context object
- Up to 32% faster*
Performance vs old*
These benchmarks were run over 5 iterations with 500 iterations per test case (representing the rare cases you may have ~500 components on the page), comparing Django native vs. Cotton for loops, block and extends, and includes.
For loop
Django average: 2.18 ms
- Cotton before: 4.65 ms
- Cotton after: 3.17 ms
✅ 31.83% improvement with the overhaul
Block and Extends (Django equivalent)
Django average: 9.38 ms
- Cotton before: 11.38 ms
- Cotton after: 10.56 ms
✅ 7.21% improvement with the overhaul
Include
Django average: 3.12 ms
- Cotton before: 3.16 ms
- Cotton after: 3.04 ms
✅ Cotton performs on-par with Django when used as partial inclusion.
⚠️ Possible breaking changes:
- Boolean attributes were previously triggered even when an attribute had an intentional empty srtring:
<c-comp myattr />
<c-comp myattr="" />
<c-comp :myattr="i_evaluate_as_empty_string" />
{{ myattr }} <!-- All cases above parse as True
This has now been fixed and only valueless attributes will render as True. Although this was unintentional, some of you may have relied on this defunct behaviour, so be sure to test.
- Support quoted json-like values in {{ attrs }} by @mattbha in #137
- updated render benchmarks by @wrabit in #138
- Support proper boolean attributes by @wrabit in #139
- Tags rewrite + optimisations (up to 28% faster) by @wrabit in
Full Changelog: v0.9.40...v1.0.0