みてるぞ 2 weeks ago
parent
commit
9bb0e736f0
1 changed files with 3 additions and 4 deletions
  1. +3
    -4
      frontend/src/pages/posts/PostListPage.tsx

+ 3
- 4
frontend/src/pages/posts/PostListPage.tsx View File

@@ -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...'}


Loading…
Cancel
Save