Skip to content

sync#433

Merged
theg1239 merged 2 commits into
devfrom
main
Jun 10, 2026
Merged

sync#433
theg1239 merged 2 commits into
devfrom
main

Conversation

@theg1239

Copy link
Copy Markdown
Member

No description provided.

cursoragent and others added 2 commits June 9, 2026 11:03
Co-authored-by: theg1239 <theg1239@users.noreply.github.com>
…n-316e

fix: avoid caching moderator pages
@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
examcooker-dev Error Error Jun 10, 2026 1:19am

@theg1239
theg1239 merged commit 90e9885 into dev Jun 10, 2026
2 of 4 checks passed
@greptile-apps

greptile-apps Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds /mod to the service worker's NO_CACHE_PATH_PREFIXES list, bypassing the cache for requests to that route family (likely a moderator panel).

  • The added entry "/mod" is missing a trailing slash. Because isUncacheable uses startsWith, this will incorrectly skip the cache for any path beginning with /mod (e.g. /modify, /models). All other route-level prefixes in the list use a trailing slash for the same reason.
  • The commit message "sync" gives no context about the change; a descriptive message would help future contributors understand why this route is excluded.

Confidence Score: 3/5

The missing trailing slash on the new prefix will cause the service worker to bypass the cache for any path starting with "/mod", not just the intended moderator routes.

The single-character omission (no trailing slash on "/mod") means every path beginning with "/mod" — not just "/mod/" sub-routes — will be excluded from service worker caching. Depending on whether routes like "/modify" or "/module" exist or are added in the future, users could silently lose offline/cache support for those pages.

public/sw.js — the new NO_CACHE_PATH_PREFIXES entry needs a trailing slash.

Important Files Changed

Filename Overview
public/sw.js Adds "/mod" to NO_CACHE_PATH_PREFIXES, but the missing trailing slash causes startsWith to match any path beginning with "/mod" (e.g. /modify, /module), not just /mod/* routes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Fetch event] --> B{request.method === GET?}
    B -- No --> Z[Pass through]
    B -- Yes --> C{Parse URL}
    C --> D{request.mode === navigate?}
    D -- Yes --> E{isUncacheable?}
    E -- Yes /mod* path --> Z
    E -- No --> F[staleWhileRevalidate PAGE_CACHE]
    D -- No --> G{isRoutePayloadRequest?}
    G -- Yes --> H{isUncacheable?}
    H -- Yes --> Z
    H -- No --> I[networkOnly]
    G -- No --> J{isSameOrigin or FONT_HOSTS?}
    J -- No --> Z
    J -- Yes --> K{isUncacheable?}
    K -- Yes /mod* path --> Z
    K -- No --> L{isStaticAsset?}
    L -- Yes --> M[cacheFirst STATIC_CACHE]
    L -- No --> N{isHtmlAccept?}
    N -- Yes --> O[staleWhileRevalidate PAGE_CACHE]
    N -- No --> P[staleWhileRevalidate RUNTIME_CACHE]
Loading

Fix All in Codex Fix All in Claude Code Fix All in Cursor

Reviews (1): Last reviewed commit: "Merge pull request #432 from ACM-VIT/cur..." | Re-trigger Greptile

Comment thread public/sw.js
"/_next/image",
"/signin",
"/ecp/",
"/mod",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 The /mod prefix lacks a trailing slash, so isUncacheable() (which uses startsWith) will bypass the cache for any path beginning with /mod — including unrelated routes like /modify, /models, /module, etc. Every other route-level prefix in this array uses a trailing slash (e.g. /ecp/, /api/, /auth/) specifically to prevent this. Add the slash to scope the exclusion to only /mod and its sub-paths.

Suggested change
"/mod",
"/mod/",

Fix in Codex Fix in Claude Code Fix in Cursor

Comment thread public/sw.js
"/_next/image",
"/signin",
"/ecp/",
"/mod",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Commit message "sync" is not descriptive — it gives no context about why /mod is being excluded from caching. A message like "feat(sw): skip cache for /mod moderator routes" would make the intent clear at a glance in the git log and help future contributors understand which routes the service worker bypasses.

Context Used: Encourage people to write better commit messages (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Codex Fix in Claude Code Fix in Cursor

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