Skip to content
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

plugin-complexity: fix bug when limits are zero #936

Merged
merged 2 commits into from
Jun 15, 2023
Merged

plugin-complexity: fix bug when limits are zero #936

merged 2 commits into from
Jun 15, 2023

Conversation

arthursimas1
Copy link
Contributor

hi all!

thanks for that awesome library. it's way easier to implement a graphql api using it!

while experimenting with it, i noticed that the plugin @pothos/plugin-complexity interprets zero-values as just an undefined limit.

i expect that a zero-value means that a limit is reached, just like a negative value.

i've changed the truthy comparison to a typeof <limit name> === 'number' where applicable. i've also added some test cases that cover zero-values and negatives (already supported, but just in case...).

i'd be glad if you consider incorporating this change.

@changeset-bot
Copy link

changeset-bot bot commented Jun 15, 2023

🦋 Changeset detected

Latest commit: 2f23a1a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@pothos/plugin-complexity Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jun 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
pothos ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 15, 2023 8:06am

@arthursimas1
Copy link
Contributor Author

arthursimas1 commented Jun 15, 2023

probably a version bump should be needed, as it can break things i think

Copy link
Owner

@hayes hayes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for this fix!

@hayes hayes merged commit 1458c42 into hayes:main Jun 15, 2023
4 checks passed
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.

None yet

2 participants