diff --git a/frontend/src/pages/posts/PostListPage.tsx b/frontend/src/pages/posts/PostListPage.tsx index 0af941d..e535138 100644 --- a/frontend/src/pages/posts/PostListPage.tsx +++ b/frontend/src/pages/posts/PostListPage.tsx @@ -65,7 +65,7 @@ export default () => { }, [loaderRef, loading]) useLayoutEffect (() => { - const savedState = sessionStorage.getItem ('posts') + const savedState = sessionStorage.getItem (`posts:${ tagsQuery }`) if (savedState && navigationType === 'POP') { const { posts, cursor, scroll } = JSON.parse (savedState) @@ -76,8 +76,6 @@ export default () => { containerRef.current.scrollTop = scroll loadMore (true) - - sessionStorage.removeItem ('posts') } else { @@ -124,7 +122,8 @@ export default () => { const statesToSave = { posts, cursor, scroll: containerRef.current?.scrollTop ?? 0 } - sessionStorage.setItem ('posts', JSON.stringify (statesToSave)) + sessionStorage.setItem (`posts:${ tagsQuery }`, + JSON.stringify (statesToSave)) }} />) : !(loading) && '広場には何もありませんよ.'} {loading && 'Loading...'}