From d5ca74209f208e1f755ee4ae859ac9854fcfa150 Mon Sep 17 00:00:00 2001 From: trinadhkoya Date: Mon, 31 Aug 2026 15:32:52 +0530 Subject: [PATCH] docs: unwrap updatePost mutation in Part 8 edit form example The EditPostForm example in Part 8 awaited the updatePost mutation without calling .unwrap(), so a failed request would not be caught and the form would navigate away as if the edit had succeeded. Part 7 already teaches calling .unwrap() inside a try/catch to surface request errors; mirror that pattern here so the tutorial handles errors consistently across both forms. Closes #4577 --- docs/tutorials/essentials/part-8-rtk-query-advanced.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/tutorials/essentials/part-8-rtk-query-advanced.md b/docs/tutorials/essentials/part-8-rtk-query-advanced.md index a818ab91b8..a929a39909 100644 --- a/docs/tutorials/essentials/part-8-rtk-query-advanced.md +++ b/docs/tutorials/essentials/part-8-rtk-query-advanced.md @@ -130,9 +130,13 @@ export const EditPostForm = () => { const content = elements.postContent.value if (title && content) { - // highlight-next-line - await updatePost({ id: post.id, title, content }) - navigate(`/posts/${postId}`) + try { + // highlight-next-line + await updatePost({ id: post.id, title, content }).unwrap() + navigate(`/posts/${postId}`) + } catch (err) { + console.error('Failed to save the post: ', err) + } } }