Skip to content

Foundation + Instant Shell for IndexedDB Admin Caching#82

Open
bhubbard wants to merge 11 commits intoemdash-cms:mainfrom
bhubbard:indexedDB
Open

Foundation + Instant Shell for IndexedDB Admin Caching#82
bhubbard wants to merge 11 commits intoemdash-cms:mainfrom
bhubbard:indexedDB

Conversation

@bhubbard
Copy link
Copy Markdown

@bhubbard bhubbard commented Apr 2, 2026

What this achieves:

  • On repeat visits, the admin shell renders instantly (sidebar, header, navigation) from cached manifest data
  • The currentUser is also cached, so permission-dependent UI renders immediately
  • Background fetches update the cache transparently
  • If IndexedDB is unavailable (private browsing), everything degrades gracefully to standard useQuery

Next phases (not yet implemented):

  • Phase 2: Cache content lists, media, users, bylines, taxonomies, menus, sections
  • Phase 3: Optimistic mutations with conflict resolution
  • Phase 4: Delta sync, sync status indicator, "Clear cache" button

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 2, 2026

⚠️ No Changeset found

Latest commit: e97af39

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@bhubbard
Copy link
Copy Markdown
Author

bhubbard commented Apr 2, 2026

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Apr 2, 2026
@bhubbard
Copy link
Copy Markdown
Author

bhubbard commented Apr 2, 2026

recheck

bhubbard and others added 4 commits April 2, 2026 12:41
… (Phases 3 & 4)

- Optimistic delete/update helpers for instant UI feedback with rollback on error
- Background sync manager with visibility-aware polling (pauses when tab hidden)
- Multi-tab cache coordination via BroadcastChannel
- Sync status indicator in header (shows syncing/offline/error states)
- "Clear Local Cache" button in General Settings
- Convert content/media delete, publish/unpublish to optimistic mutations
- Convert menus and sections to use optimistic delete

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bhubbard bhubbard marked this pull request as draft April 2, 2026 22:28
bhubbard and others added 3 commits April 2, 2026 22:22
CacheProvider calls useQueryClient(), so it needs QueryClientProvider
as an ancestor. The reversed nesting caused the dashboard to hang on
load.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
56 tests across 6 test files covering:
- db.ts: database setup, schema creation, connection lifecycle
- cache-store.ts: CRUD operations, TTL expiry, pruning, index queries
- cache-warmup.ts: singleton pre-loading from IndexedDB
- broadcast.ts: BroadcastChannel multi-tab coordination
- sync.ts: background sync manager lifecycle and status
- optimistic-mutation.ts: optimistic delete/update/rollback

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bhubbard bhubbard marked this pull request as ready for review April 3, 2026 05:43
@bhubbard
Copy link
Copy Markdown
Author

bhubbard commented Apr 3, 2026

All 4 phases from the plan are complete:

Phase 1: Foundation + Instant Shell ✅ — IDB schema, cache-store, useCachedQuery, warmup, CacheProvider
Phase 2: Entity Caching ✅ — All major list/detail views cached (content, media, menus, sections, taxonomies, bylines, users)
Phase 3: Optimistic Mutations ✅ — optimisticDelete, optimisticUpdate, optimisticListItemUpdate helpers, applied to content/media/menu/section deletes and publish/unpublish
Phase 4: Delta Sync + Polish ✅ — Background sync manager, multi-tab BroadcastChannel, sync indicator in header, "Clear Local Cache" in settings

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

Overlapping PRs

This PR modifies files that are also changed by other open PRs:

This may cause merge conflicts or duplicated work. A maintainer will coordinate.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 5, 2026

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@82

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@82

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@82

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@82

emdash

npm i https://pkg.pr.new/emdash@82

create-emdash

npm i https://pkg.pr.new/create-emdash@82

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@82

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@82

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@82

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@82

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@82

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@82

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@82

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@82

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@82

commit: e97af39

@BenjaminPrice
Copy link
Copy Markdown
Contributor

This is a large PR. Could you please update the PR description to reflect the state of the PR (all phases completed, as per your comment) and use the template provided?

https://github.com/emdash-cms/emdash/blob/main/.github/PULL_REQUEST_TEMPLATE.md

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants