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

chore: add debug logging for sw #363

Merged
merged 6 commits into from
May 10, 2023
Merged

chore: add debug logging for sw #363

merged 6 commits into from
May 10, 2023

Conversation

SgtPooki
Copy link
Contributor

@SgtPooki SgtPooki commented May 9, 2023

  • Adds debug logging for SW
  • Enables sending a message to the SW on page load to let users use their same localStorage.setItem('debug', <debugString>) method of enabling debugging
  • ensures SW always returns a response (previously, it could return cachedResponse=undefined)

@vercel
Copy link

vercel bot commented May 9, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
starmaps ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 10, 2023 8:44pm

}

async _handle(request: Request, handler: StrategyHandler): Promise<Response | undefined> {
async _handle(request: Request, handler: StrategyHandler): Promise<Response> {
Copy link

Choose a reason for hiding this comment

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

Function _handle has 29 lines of code (exceeds 25 allowed). Consider refactoring.

Copy link
Contributor Author

@SgtPooki SgtPooki left a comment

Choose a reason for hiding this comment

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

self-review

Copy link
Collaborator

@whizzzkid whizzzkid left a comment

Choose a reason for hiding this comment

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

nits!

pages/_app.tsx Outdated Show resolved Hide resolved
@@ -1,6 +1,14 @@
/* eslint-disable import/no-unused-modules */
import { Strategy, StrategyHandler } from 'workbox-strategies';
import Dexie from 'dexie';
import debug from 'debug';
Copy link
Collaborator

Choose a reason for hiding this comment

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

only if the could have an export for webWorker which would not be based on localStorage sync api.

sw/service-worker.ts Outdated Show resolved Hide resolved
Co-authored-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>
Co-authored-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants