Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scroll Restoration #17

Closed
hyesungoh opened this issue Apr 2, 2022 · 0 comments · Fixed by #22
Closed

Scroll Restoration #17

hyesungoh opened this issue Apr 2, 2022 · 0 comments · Fixed by #22
Assignees
Labels
enhancement New feature or request

Comments

@hyesungoh
Copy link
Owner

hyesungoh commented Apr 2, 2022

Description

index에서 scroll 후 [slug] 방문 시 store restoration되지 않음

시도한 방법

Route.events

route를 벗어날 때 스크롤 좌표를 caching한 후, 돌아왔을 때 캐싱된 값만큼 scroll

+기존 구조를 바꾸지 않아도 쉽게 적용 가능함
-일반 `window.scrollTo`를 사용할 시 `race condition` 이슈로 dom 변경이 block되어,  setTimeout을 이용하여 적용해야 동작함
-하지만 infinite scroll된 값까지 적용되진 않음

Route as Modal

+infinite scroll된 스크롤까지 적용
-위 구현방법보다 구조를 많이 바꿔야 함
-SSG이기 때문에 index route와 slug route 모두 생성하여 빌드시간이 n에서 n^2으로 늘어남

Next.config.js

해당 이슈를 참고하였으나 작동하지 않음.

infinite scroll된 값까지 적용된다면 가장 적절한 해결방법같아 보이지만, 추가적인 시도를 해봐야할 것으로 판단

@hyesungoh hyesungoh added the enhancement New feature or request label Apr 2, 2022
@hyesungoh hyesungoh self-assigned this Apr 2, 2022
@hyesungoh hyesungoh linked a pull request Apr 3, 2022 that will close this issue
hyesungoh added a commit that referenced this issue Apr 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant