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

fix equality for objects #2100

Conversation

pelletier197
Copy link
Contributor

@pelletier197 pelletier197 commented Apr 4, 2022

Description

Modified equality logic to perform deep equality. As in javascript

{ test: 'a' } === { test: 'a' } 

returns false, which was making argument equality fail for lists of objects.

Fixes # (issue)
#2099

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Unit tests. If you run the same tests on master, they will fail.

Checklist:

  • I have followed the CONTRIBUTING doc and the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@vercel
Copy link

vercel bot commented Apr 4, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/theguild/graphql-inspector/5C565ZhkmJ4kQHsGURFPhPxq8mJm
✅ Preview: https://graphql-inspector-git-fork-pelletier197-feature-9655f8-theguild.vercel.app

@rperryng
Copy link

rperryng commented Apr 6, 2022

👋 , not a maintainer/contributor, just someone else who's keen for this bug fix as well.

I think you need to reference your new isEqual implementation in the diffArrays function as well since this is the codepath creating the FieldArgumentDefaultChanged Change, and it's currently using ===

Edit: Actually, since it's wrapped in the isNotEqual check first it should be fine ☺️ , though it would probably still make sense to do, 🤷

@pelletier197
Copy link
Contributor Author

You're right. I didn't see this part. Indeed, it wouldn't be necessary for the bugfix, but in the case the two are not equal, the diff might output wrong. I'll do the change. Thanks!

@pelletier197
Copy link
Contributor Author

@kamilkisiela Sorry to tag you directly, but this has been pending for over a month and it's really small. If you can't review this, is there someone that can?

@kamilkisiela kamilkisiela force-pushed the feature/fix-equality-check-for-objects branch from 2e1aa73 to d152230 Compare June 30, 2022 14:51
@vercel
Copy link

vercel bot commented Jun 30, 2022

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

Name Status Preview Updated
graphql-inspector ✅ Ready (Inspect) Visit Preview Jun 30, 2022 at 2:55PM (UTC)

@kamilkisiela kamilkisiela merged commit 28736af into kamilkisiela:master Jun 30, 2022
@pelletier197 pelletier197 deleted the feature/fix-equality-check-for-objects branch July 3, 2022 21:21
kamilkisiela added a commit that referenced this pull request Jul 6, 2022
kamilkisiela added a commit that referenced this pull request Jul 6, 2022
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.

3 participants