Service worker: precache the shell and the visited studios, not 174 files

Closed
#431 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
68/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
nextjs, typescript

Research direction

Read scripts/generate-service-worker.mjs and components/layout/pwa-register.tsx, then inspect the offline flow in tests/e2e/flows.spec.ts. Measure current install bytes before changing the precache behavior. Done means the shell and previously visited studios work offline, install transfers under half the current bytes, and a two-build update replaces old caches cleanly.

Written by the indexing model from the issue text.

Description

area: ui difficulty: medium enhancement help wanted performance v2.0.0

Summary

On install the service worker precaches 174 resources, which is a heavy first visit on a slow connection. Precache the app shell and the visited studios' files as they are visited, with the offline e2e flow as the guard.

Part of the 2.0.0 plan: fewer, better and fully tested studios, on a calmer and faster site.

Where to look

  • scripts/generate-service-worker.mjs and public/sw.js
  • components/layout/pwa-register.tsx
  • tests/e2e/flows.spec.ts: the offline flow

Behaviour

  • Precache the shell (home, the layout chunks, fonts the UI uses) and cache each studio's route and chunks the first time it is opened, with a size cap.
  • Keep versioned caches and the cleanup of old ones.
  • A studio never opened online is not promised offline, and the app says so when it can't load.

Acceptance criteria

  • The install transfers well under half of today's bytes (record before and after).
  • The offline flow passes for a studio that was opened online.
  • Updating to a new build still replaces the caches cleanly (test with two builds).

Getting started: fork the repo, then pnpm install and pnpm dev (Node 22+, pnpm 11, no API keys). Before opening a PR, run pnpm typecheck && pnpm test && pnpm lint && pnpm format:check && pnpm check:dashes && pnpm build (CI fails on unformatted files, so pnpm format first). See CONTRIBUTING.md and the first contribution walkthrough.

Everything needed is in the repository. This doesn't need maintainer access, secrets or paid services. Comment below to claim it, and ask questions here any time.

Dominant language
TypeScript
Stars
11
Forks
3
Avg merge
5h 22m
Merged PRs (30d)
74

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from yakew7/DesignHub

All issues in yakew7/DesignHub

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.