From de1ad63a4b25ca5763ff020c6eca8a00297a0f57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Go=CC=81mez=20Bachiller?= Date: Mon, 29 Apr 2024 00:38:33 +0200 Subject: [PATCH] fix: scroll up in parallel routes --- src/app/books/components/book-card.tsx | 3 ++- src/components/scroll-up.tsx | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/components/scroll-up.tsx diff --git a/src/app/books/components/book-card.tsx b/src/app/books/components/book-card.tsx index 44fce6b..66167ed 100644 --- a/src/app/books/components/book-card.tsx +++ b/src/app/books/components/book-card.tsx @@ -3,6 +3,7 @@ import Image from 'next/image' import Link from 'next/link' import { BookCardForm } from '@/app/books/components/book-card-form' +import { ScrollUp } from '@/components/scroll-up' import { BookResponse } from '@/core/book/dto/responses/book.response' import { UserResponse } from '@/core/user/dto/responses/user.response' @@ -32,6 +33,7 @@ export function BookCard(properties: BookCardProperties) { return ( <> +
window.document.scrollingElement?.scrollTo(0, 0), []) + + return null +}