Title: Reduce layout shift (CLS) on reload via localStorage cache + skeleton placeholders · Issue #1 · JavaScriptSolidServer/git · GitHub
Open Graph Title: Reduce layout shift (CLS) on reload via localStorage cache + skeleton placeholders · Issue #1 · JavaScriptSolidServer/git
X Title: Reduce layout shift (CLS) on reload via localStorage cache + skeleton placeholders · Issue #1 · JavaScriptSolidServer/git
Description: Problem When reloading jss.live/git/?repo=
Open Graph Description: Problem When reloading jss.live/git/?repo=
X Description: Problem When reloading jss.live/git/?repo=<URL>, content arrives in waves: Page paints with just the URL form + brand Refs fetch completes → repo header + tabs render Clone completes → file t...
Opengraph URL: https://github.com/JavaScriptSolidServer/git/issues/1
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Reduce layout shift (CLS) on reload via localStorage cache + skeleton placeholders","articleBody":"## Problem\n\nWhen reloading `jss.live/git/?repo=\u003cURL>`, content arrives in waves:\n\n1. Page paints with just the URL form + brand\n2. Refs fetch completes → repo header + tabs render\n3. Clone completes → file tree appears\n4. README blob fetched → README renders\n5. Sidebar stats populate\n\nEach step causes layout shift (CLS). Visible churn for ~1–2 seconds on every reload.\n\n## Solution\n\n### Part 1 — localStorage cache (high impact)\n\nSave last-rendered state per repo URL after a successful load:\n\n```js\nlocalStorage.setItem(`jss-git:${repoUrl}`, JSON.stringify({\n refs, tree, readmeHtml, latestCommit, branch, commits, savedAt: Date.now(),\n}));\n```\n\nOn page load: if URL matches a cached entry, paint cached state immediately, then fetch fresh data in background. If fresh data differs, swap in (could even diff and only update changed regions, but full re-render is fine for v1).\n\nThis is the pattern GitHub uses for instant page loads on repeat visits.\n\n### Part 2 — skeleton placeholders (medium impact)\n\nEven on first visit (no cache), reserve layout space upfront. Render the grid container, sidebar shell, tabs placeholder, and a gray-rectangle skeleton for the file list before data arrives. Eliminates the URL-form-only flash before content fills in.\n\n```css\n.skeleton-row { background: #eaeef2; height: 2.5rem; border-radius: 4px; margin: 0.25rem 0; }\n.skeleton-pulse { animation: pulse 1.5s infinite; }\n```\n\n## Combined effect\n\n| Visit | Without fix | With fix |\n|---|---|---|\n| First | URL form → wave of paints (CLS) | URL form + skeleton → smooth swap |\n| Repeat | URL form → wave of paints (CLS) | Instant from cache → background refresh |\n\n## Constraints\n\n- Cache TTL: stay reasonable (24h?) to avoid stale state across long gaps\n- Wipe cache on `wipe: true` LightningFS reinstantiation (already happens on each session)\n- Storage budget: each repo state is ~10–50 KB JSON; localStorage 5MB limit handles many repos\n- Sensitive content concern: localStorage is per-origin, low risk for public repo views; private repos via auth would need separate handling later\n\n## Acknowledgement\n\nLayout-shift improvement was suggested by Michael Peters in chat following the v13 announcement. Patch matches GitHub's \"instant load\" pattern.","author":{"url":"https://github.com/melvincarvalho","@type":"Person","name":"melvincarvalho"},"datePublished":"2026-05-08T13:09:39Z","url":"https://github.com/JavaScriptSolidServer/git/issues/1"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:aeded7ba-aebf-7ab1-9051-760b55c87f5e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CD96:2CA452:14EE9C9:1AA2E36:6B03A2C1 |
| html-safe-nonce | 6ced0a861dbcb5a985db547b7f6626db86c68d1bc1632dc3c690612b032f86bf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRDk2OjJDQTQ1MjoxNEVFOUM5OjFBQTJFMzY6NkIwM0EyQzEiLCJ2aXNpdG9yX2lkIjoiMzUzMzYzNTkwMTY0MzI2ODgwMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5bda1f5fbb5eb243295e052c0b27310d3e22dc0ca6bf9992a79073290577f1cc |
| hovercard-subject-tag | issue:4406627619 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JavaScriptSolidServer/git/1/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a3ea4def4a18c9504504bc8159adba3cc7f796e393984a9e1291b9e698774f38/JavaScriptSolidServer/git/issues/1 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a3ea4def4a18c9504504bc8159adba3cc7f796e393984a9e1291b9e698774f38/JavaScriptSolidServer/git/issues/1 |
| og:image:alt | Problem When reloading jss.live/git/?repo= |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | melvincarvalho |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/JavaScriptSolidServer/git git https://github.com/JavaScriptSolidServer/git.git |
| octolytics-dimension-user_id | 205442424 |
| octolytics-dimension-user_login | JavaScriptSolidServer |
| octolytics-dimension-repository_id | 1232469527 |
| octolytics-dimension-repository_nwo | JavaScriptSolidServer/git |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1232469527 |
| octolytics-dimension-repository_network_root_nwo | JavaScriptSolidServer/git |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width