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

feat : 오프라인에서 캐시를 사용할 수 있도록 서비스 워커 파일 추가 #374

Merged
merged 3 commits into from
Dec 6, 2024

Conversation

smosco
Copy link
Collaborator

@smosco smosco commented Dec 6, 2024

📄 Description of the PR

🔧 What has been changed?

  • 오프라인에서 캐시를 사용할 수 있도록 서비스 워커 파일을 추가했습니다.
  • 네트워크가 연결되어 있다면 무조건 새로 받아오고 캐시에 put 합니다.
  • 네트워크 요청 실패하면 캐시에서 응답을 반환합니다.
  • 만약 오프라인 상태이고 캐시도 없다면 offline.html 을 반환합니다.
  • html 파일을 반환하려면 이것도 캐싱해줘야 해서 install 이벤트에서 해줍니다.
  • 서비스 워커는 일단 HomePageClient useEffect에서 등록합니다.

📸 Screenshots / GIFs (if applicable)

image

⚠️ Precaution & Known issues

  • 서비스 워커 등록된지는 애플리케이션 탭에서 확인할 수 있습니다.

✅ Checklist

  • UI 브랜치 같이 확인해서 이슈없는지 확인해보기
  • 함수 이름, 변수 이름만 봐도 어떤 기능을 하는지 파악할 수 있는지 (선언적인 코드인지 확인)

@smosco smosco requested a review from godhyzzang December 6, 2024 08:30
@smosco smosco self-assigned this Dec 6, 2024
@smosco smosco linked an issue Dec 6, 2024 that may be closed by this pull request
3 tasks
Copy link
Collaborator

@godhyzzang godhyzzang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지금 시크릿탭에서는 리딩디테일페이지 접속까지 가능하지만 일반탭에서는 캐시 데이터를 못 불러오는 문제가 발생하네요. 머지하고 제 컴퓨터에서 동일한 문제가 일어나는지 한번 시도해보죠~

@godhyzzang godhyzzang merged commit 0634096 into develop Dec 6, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] pwa service worker offline
2 participants