Skip to content

Commit f25a9d1

Browse files
itsjoeouifacebook-github-bot
authored andcommitted
add missing generic type parameter for mutation tutorial example (#4981)
Summary: https://relay.dev/docs/tutorial/mutations-updates/#step-4--modify-the-updatable-data This step of the tutorial is currently giving us type errors. ![CleanShot 2025-05-05 at 18 09 58@2x](https://github.com/user-attachments/assets/02359c4b-5910-4c81-9b12-2d914dbd7eca) This is because we are missing the generic type parameter. Note that this will also require us to upstream the relay dependencies in the example to the latest v19: relayjs/relay-examples#333 After that, our tutorial will be working properly with no type error! Pull Request resolved: #4981 Reviewed By: evanyeung Differential Revision: D74219468 Pulled By: captbaritone fbshipit-source-id: f2c37de0d0400e0a376cdd7ca89c1c7ef3bd0946
1 parent 3de18da commit f25a9d1

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

website/docs/tutorial/mutations-updates.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ function StoryLikeButton({story}) {
359359
const {
360360
// color1
361361
updatableData
362-
} = store.readUpdatableFragment(
362+
} = store.readUpdatableFragment<StoryLikeButton_updatable$key>(
363363
// color2
364364
fragment,
365365
// color3
@@ -384,7 +384,11 @@ function StoryLikeButton({story}) {
384384
doesViewerLike
385385
}
386386
`;
387-
const {updatableData} = store.readUpdatableFragment(fragment, story);
387+
const { updatableData } =
388+
store.readUpdatableFragment<StoryLikeButton_updatable$key>(
389+
fragment,
390+
story
391+
);
388392
// change
389393
const alreadyLikes = updatableData.doesViewerLike;
390394
updatableData.doesViewerLike = !alreadyLikes;

website/versioned_docs/version-v19.0.0/tutorial/mutations-updates.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ function StoryLikeButton({story}) {
359359
const {
360360
// color1
361361
updatableData
362-
} = store.readUpdatableFragment(
362+
} = store.readUpdatableFragment<StoryLikeButton_updatable$key>(
363363
// color2
364364
fragment,
365365
// color3
@@ -384,7 +384,11 @@ function StoryLikeButton({story}) {
384384
doesViewerLike
385385
}
386386
`;
387-
const {updatableData} = store.readUpdatableFragment(fragment, story);
387+
const { updatableData } =
388+
store.readUpdatableFragment<StoryLikeButton_updatable$key>(
389+
fragment,
390+
story
391+
);
388392
// change
389393
const alreadyLikes = updatableData.doesViewerLike;
390394
updatableData.doesViewerLike = !alreadyLikes;

0 commit comments

Comments
 (0)