strawberry
strawberry copied to clipboard
Fix usage with default and default_factory arguments
Description
Currently it is not always possible to use the default and default_factory argument on strawberry.field. It fails randomly and especially on root Query This PR fixes the issue.
Types of Changes
- [ ] Core
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement/optimization
- [ ] Documentation
Issues Fixed or Closed by This PR
Checklist
- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] I have read the CONTRIBUTING document.
- [x] I have added tests to cover my changes.
- [ ] I have tested the changes and verified that they work and don't break anything (as well as I can manage).
Thanks for adding the RELEASE.md file!

Here's a preview of the changelog:
Fix using strawberry with default or default_factory (dataclasses basics)
Here's the tweet text:
🆕 Release (next) is out! Thanks to Alexander for the PR 👏
Get it here 👉 https://beta.strawberry.rocks/release/(next)
Codecov Report
Merging #3333 (830a729) into main (ba65949) will decrease coverage by
0.02%. The diff coverage is84.00%.
Additional details and impacted files
@@ Coverage Diff @@
## main #3333 +/- ##
==========================================
- Coverage 96.62% 96.61% -0.02%
==========================================
Files 485 485
Lines 30292 30316 +24
Branches 3746 3751 +5
==========================================
+ Hits 29271 29291 +20
- Misses 832 835 +3
- Partials 189 190 +1
CodSpeed Performance Report
Merging #3333 will not alter performance
Comparing devkral:fix/root_defaults (830a729) with main (ba65949)
Summary
✅ 12 untouched benchmarks