Skip to content

feat: add PWA offline dashboard support#1184

Closed
Kishalll wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
Kishalll:feat/issue-1050
Closed

feat: add PWA offline dashboard support#1184
Kishalll wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
Kishalll:feat/issue-1050

Conversation

@Kishalll
Copy link
Copy Markdown
Contributor

Summary

Adds PWA offline support so the dashboard can load with cached data when the app is offline.

Closes #1050

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / code cleanup

Changes Made

  • Added next-pwa and configured runtime caching in next.config.mjs.
  • Added network-first caching for dashboard/API routes, GitHub API responses, and goals/streak/metrics
    data.
  • Added cache-first handling for static assets and fonts with 24-hour cache expiry.
  • Added a global OfflineBanner that shows Offline — showing cached data.
  • Added a custom service worker layer to refresh dashboard caches when the connection returns.
  • Added safe offline JSON fallbacks for uncached API requests so widgets do not stay stuck in skeleton
    loading.
  • Added background sync queueing for POST /api/goals/sync.
  • Regenerated production service worker assets.

How to Test

  1. Run npm run build.
  2. Run npm run start.
  3. Open http://localhost:3000/dashboard with internet enabled.
  4. Wait for dashboard widgets to finish loading.
  5. Confirm /sw.js is registered in browser DevTools under Application/Service Workers.
  6. Turn off internet or enable offline mode in DevTools.
  7. Reload /dashboard.
  8. Verify the dashboard loads with cached/fallback data and shows the offline banner.

Screenshots (if UI change)

image

Checklist

  • Linked issue in summary
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Self-reviewed the diff
  • Added/updated tests if applicable

Validation completed: npm run build passes.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 26, 2026

@Kishalll is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature labels May 26, 2026
@github-actions
Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@Kishalll
Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder completed both the prs assigned to me , ready to work on other issues

@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

CI is failing on this PR. Please fix the failing checks before this can be merged.

@Kishalll
Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder fixed ci issues and the pr is not clean

Copy link
Copy Markdown
Owner

@Priyanshu-byte-coder Priyanshu-byte-coder left a comment

Choose a reason for hiding this comment

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

Thanks for working on PWA offline support! However, there are significant issues with this implementation:

  1. Committed pre-built service worker filespublic/sw.js, public/workbox-07cb5bfa.js, public/fallback-Gl9L3J2PvQllaLGPIoSXH.js, and public/worker-Gl9L3J2PvQllaLGPIoSXH.js are build artifacts with content-hashed filenames. These should be gitignored and generated at build time — committing them means they'll go stale after the next build.

  2. next.config.mjs changes — 127+ line diff to a critical config file needs careful review. Please explain what each change does.

  3. worker/index.js — 233 lines of service worker logic. Is this the source for the build artifacts in public/? If so, the build step should generate the public files from this source.

Recommended approach:

  • Add the generated service worker files to .gitignore
  • Add a build step that generates them from source
  • Keep next.config.mjs changes minimal

Please rework the implementation to not commit build artifacts to the repo.

Copy link
Copy Markdown
Owner

@Priyanshu-byte-coder Priyanshu-byte-coder left a comment

Choose a reason for hiding this comment

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

Two issues:

  1. The PR commits built artifacts directly: public/sw.js, public/workbox-07cb5bfa.js, public/fallback-*.js, public/worker-*.js. Generated files should not be committed to the repo.
  2. The next.config.mjs change conflicts with current main.

Please remove the built PWA artifacts from the commit and rebase onto current main. The next-pwa integration is otherwise a good addition.

@Kishalll
Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder will do a pr fixing this shortly

@Priyanshu-byte-coder Priyanshu-byte-coder added gssoc:approved GSSoC: PR approved for scoring level:advanced GSSoC: Advanced difficulty (55 pts) labels May 28, 2026
Copy link
Copy Markdown
Owner

@Priyanshu-byte-coder Priyanshu-byte-coder left a comment

Choose a reason for hiding this comment

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

This PR includes compiled PWA build artifacts (public/sw.js, public/workbox-*.js, etc.) that should not be committed to the repository — these are generated at build time. Please add these to .gitignore and remove them from the PR. Also rebase on main to resolve the existing conflicts.

@Kishalll
Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder Updated PR based on the review comments and resolved conflicts.

  • Removed committed generated PWA artifacts from the PR.
  • Added generated PWA files to .gitignore.
  • Removed the orphan worker/index.js.
  • Kept the next-pwa integration so public/sw.js is generated at build time instead of committed.
  • Resolved the package-lock.json and src/app/layout.tsx conflicts.

@github-actions github-actions Bot added the type:testing GSSoC type bonus: tests (+10 pts) label May 28, 2026
Copy link
Copy Markdown
Owner

@Priyanshu-byte-coder Priyanshu-byte-coder left a comment

Choose a reason for hiding this comment

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

PR still includes compiled PWA build artifacts: public/sw.js, public/workbox-*.js. These are generated at build time and must not be committed. Add them to .gitignore and remove them from the PR, then rebase on main.

@github-actions github-actions Bot added type:design GSSoC type bonus: UI/design (+10 pts) type:devops GSSoC type bonus: devops (+15 pts) labels May 29, 2026
@Kishalll
Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder sorry for all the confusions earlier, i commited new changes along w old ones without force pushing that caused a lot of issue and i hv cleaned those noe,
pls review

@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

PWA offline support merged into main (commit f27c710). Thank you @Kishalll!

Priyanshu-byte-coder added a commit that referenced this pull request May 29, 2026
Also fixes missing Syne/JetBrains_Mono font imports in layout.tsx.

Co-authored-by: Kishalll <kishal2007@gmail.com>
@Kishalll
Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder the mergre conflicts needs to resolved before merge ryt ??to work properly, i was working on this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC: PR approved for scoring gssoc26 GSSoC 2026 contribution level:advanced GSSoC: Advanced difficulty (55 pts) type:design GSSoC type bonus: UI/design (+10 pts) type:devops GSSoC type bonus: devops (+15 pts) type:feature GSSoC type bonus: new feature type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add PWA offline support with cached dashboard data

2 participants