-
-
Notifications
You must be signed in to change notification settings - Fork 549
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
Bugfix Extensions Added Twice When Custom Directives Are Present #3776 #3783
Bugfix Extensions Added Twice When Custom Directives Are Present #3776 #3783
Conversation
Reviewer's Guide by SourceryThis pull request fixes an issue in the get_extensions function where extensions were being appended twice when custom directives are present. The fix modifies the extension concatenation logic to ensure that extensions are added only once while maintaining their order, and introduces new tests to validate the correct behavior. No diagrams generated as the changes look simple and do not need a visual representation. File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @doney-dkp - I've reviewed your changes - here's some feedback:
Overall Comments:
- It's great that you've added tests to cover this bugfix.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Thanks for adding the Here's a preview of the changelog: This release fixes an issue where extensions were being duplicated when custom directives were added to the schema. Previously, when user directives were present, extensions were being appended twice to the extension list, causing them to be executed multiple times during query processing. The fix ensures that extensions are added only once and maintains their original order. Test cases have been added to validate this behavior and ensure extensions are executed exactly once. Here's the tweet text:
|
Thanks for adding the Here's a preview of the changelog: This release fixes an issue where extensions were being duplicated when custom directives were added to the schema. Previously, when user directives were present, extensions were being appended twice to the extension list, causing them to be executed multiple times during query processing. The fix ensures that extensions are added only once and maintains their original order. Test cases have been added to validate this behavior and ensure extensions are executed exactly once. Here's the tweet text:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
Thank you so much! Love the tests 😊
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3783 +/- ##
=======================================
Coverage 97.24% 97.24%
=======================================
Files 502 503 +1
Lines 33481 33509 +28
Branches 1714 1714
=======================================
+ Hits 32558 32586 +28
Misses 706 706
Partials 217 217 |
CodSpeed Performance ReportMerging #3783 will not alter performanceComparing Summary
|
Thanks for contributing to Strawberry! 🎉 You've been invited to join You can also request a free sticker by filling this form: https://forms.gle/dmnfQUPoY5gZbVT67 And don't forget to join our discord server: https://strawberry.rocks/discord 🔥 |
When custom directives are added, extensions are appended twice in the get_extensions function in the schema.py file.
Description
This fixes an issue where extensions were being duplicated when custom directives were added to the schema. Previously, when user directives were present, extensions were being appended twice to the extension list, causing them to be executed multiple times during query processing.
The fix ensures that extensions are added only once and maintains their original order. Test cases have been added to validate this behavior and ensure extensions are executed exactly once.
Types of Changes
Issues Fixed or Closed by This PR
Previous Behavior:
When creating a schema with both extensions and directives:
The LoggingExtension would be executed twice, resulting in:
After this fix, the same code will execute the extension only once:
Extension executed
The fix ensures that extensions are added only once to the extension list while maintaining their original order. Test cases have been added to validate this behavior and ensure extensions are executed exactly once.
Impact:
Improves performance by preventing duplicate extension execution
Maintains expected extension behavior
Preserves extension order in the schema
To validate this fix, new test cases have been added that verify extension uniqueness and execution count.
Checklist
Summary by Sourcery
Bug Fixes: