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

[useResponseCache] Ignore specfic schemaCoordinates for IdFields which are not the root of a subgraph #2249

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Kendalor
Copy link

@Kendalor Kendalor commented Jun 6, 2024

🚨 IMPORTANT: Please do not create a Pull Request without creating an issue first.

Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of
the pull request.

Description

Add a new optionalList of schemaCoordinates to the useResponseCacheParamters, which is used to exclude fields on specific objects in the mapSchema step.

Fixes #2247

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

Screenshots/Sandbox (if appropriate/relevant):

N/A

How Has This Been Tested?

Testet fix first on our case and environment by maintaining a parallel instance of this plugin. Further added Unit tests to first reproduce the Issue and proof the fix works.

  • Added Test "'id field in body overwritten and request fails'"
  • Added Test "'id field in body is returned as is and not overwritten'"

Test Environment:

  • OS: macOs: Sonoma 14.5
  • @envelop/response-cache: 6.2.0
  • NodeJS: 10.5.0

Checklist:

  • [ x] I have followed the
    CONTRIBUTING doc and the
    style guidelines of this project
  • [ x] I have performed a self-review of my own code
  • I have commented on 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

N/A

Copy link

changeset-bot bot commented Jun 6, 2024

⚠️ No Changeset found

Latest commit: 45271af

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@Kendalor
Copy link
Author

@ardatan is anythign missing ? Should the changeset be created by me ?

@ardatan
Copy link
Collaborator

ardatan commented Jun 18, 2024

@EmrysMyrddin Could you review?

@EmrysMyrddin
Copy link
Collaborator

Hi, I'm not entirely against this feature, but I'm afraid we are introducing it to workaround an actual bug.
I'm not sure to entirely understand what is happening here. We should probably first investigate why the plugin behave like this.

@Kendalor
Copy link
Author

Kendalor commented Jul 3, 2024

@EmrysMyrddin how would you suggest to move forward ?
From my expierience/debugging suggestion the plugin identifies every object with an "id" field (configurable) as a cachable entity from a subgraph. If Subgraph A returns a value containing a field with an "id", the plugin seems to remove this part of the resonse while stitching the response together from a non existing subgraph B. Therefore setting the field to null.

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.

[useResponseCache] Ignore specfic schemaCoordinates for IdFields which are not the root of a subgraph
3 participants