From ab58c86695f258d8ee4333d657012453cb3c3281 Mon Sep 17 00:00:00 2001 From: Asnxthaony Date: Sat, 12 Feb 2022 18:04:49 +0800 Subject: [PATCH] reset page to 1 on new search --- .../assets/src/views/skinlib/SkinLibrary/index.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/assets/src/views/skinlib/SkinLibrary/index.tsx b/resources/assets/src/views/skinlib/SkinLibrary/index.tsx index 246c044e..5eb5db4e 100644 --- a/resources/assets/src/views/skinlib/SkinLibrary/index.tsx +++ b/resources/assets/src/views/skinlib/SkinLibrary/index.tsx @@ -115,11 +115,15 @@ const SkinLibrary: React.FC = () => { const handleFormSubmit = (event: React.FormEvent) => { event.preventDefault() setKeyword(name) + setPage(1) } const handleLikesSortClick = () => setSort('likes') const handleTimeSortClick = () => setSort('time') - const handleSelfUploadClick = () => setUploader(currentUid) + const handleSelfUploadClick = () => { + setUploader(currentUid) + setPage(1) + } const handleResetClick = () => { setFilter('skin') setName('') @@ -129,7 +133,10 @@ const SkinLibrary: React.FC = () => { setPage(1) } - const handleUploaderClick = (uploader: number) => setUploader(uploader) + const handleUploaderClick = (uploader: number) => { + setUploader(uploader) + setPage(1) + } const handleAddToCloset = async (item: LibraryItem, index: number) => { if (!currentUid) {