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

feat: add (record|remove)ArtworkView mutations #6323

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dblandin
Copy link
Member

@dblandin dblandin commented Dec 17, 2024

  • add recordArtworkView mutation to replace stitched version from Gravity
  • new removeArtworkView mutation

Leverages API endpoints added in https://github.com/artsy/gravity/pull/18432.

@dblandin dblandin requested a review from nickskalkin December 17, 2024 14:18
@dblandin dblandin self-assigned this Dec 17, 2024
@artsy-peril
Copy link
Contributor

artsy-peril bot commented Dec 17, 2024


Warnings
⚠️ The V2 schema in this PR has breaking changes with Force. Remember to update the Force schema if necessary.

Type 'RecordArtworkViewInput' was removed
Type 'RecordArtworkViewPayload' was removed
Field 'Mutation.recordArtworkView' changed type from 'RecordArtworkViewPayload' to 'RecordArtworkViewMutationPayload'
Type for argument 'input' on field 'Mutation.recordArtworkView' changed from 'RecordArtworkViewInput!' to 'RecordArtworkViewMutationInput!'

Generated by 🚫 dangerJS against 8680810

- add recordArtworkView mutation to replace stitched version from Gravity
- new removeArtworkView mutation
@dblandin dblandin force-pushed the dblandin/record-remove-artwork-view-mutations branch from edb0489 to 8680810 Compare December 17, 2024 14:31
Copy link
Contributor

@nickskalkin nickskalkin left a comment

Choose a reason for hiding this comment

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

Cool! Left a small suggestion how to avoid breaking relay change

@@ -17717,23 +17723,18 @@ type RecentlySoldArtworkTypeEdge {
node: RecentlySoldArtworkType
}

# Autogenerated input type of RecordArtworkView
input RecordArtworkViewInput {
Copy link
Contributor

Choose a reason for hiding this comment

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

Did a cool thingy @mzikherman taught me - if not sure whether schema will add a breaking change - copy new schema to clients and run yarn relay. I did it in Force and Eigen. Force doesn't complain, but Eigen does:

[ERROR] Error: ✖︎ Unknown type 'RecordArtworkViewInput'. Did you mean `RecordArtworkViewMutationInput`?

  src/app/Scenes/Artwork/Artwork.tsx:261:59
  260 
  261 │         mutation ArtworkMarkAsRecentlyViewedQuery($input: RecordArtworkViewInput!) {
      │                                                           ^^^^^^^^^^^^^^^^^^^^^^
  262 │           recordArtworkView(input: $input) {

[ERROR] Compilation failed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks!! Yeah, this will cause a compilation error for sure because Eigen is explicitly referencing RecordArtworkViewInput which has been removed in this diff. I wonder though if this would also cause a runtime error? Will check on that... if this doesn't cause any runtime backwards-incompatibility, I think we could merge this in (with type name changes) and follow-up with an Eigen PR to address the compilation error.

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't quote me on this - but I think changing the name like that, if a Relay client explicitly references the name - will indeed cause a runtime error if you merge the schema update. Give it a whirl to confirm (and we start to increase our mental model of how to think about these kinds of changes with our clients).

any,
ResolverContext
>({
name: "RecordArtworkViewMutation",
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering, if you omit Mutation here - will it produce the schema without changes that break relay (RecordArtworkViewInput -> RecordArtworkViewMutationInput)

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmmm, now that I look closer it seems like we're a bit inconsistent with suffixing these names with Mutation in the file itself... I wonder if relay adds Mutation anyway but I'll check.

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