solid-optimistic-ui
Use when Solid app interactions block on pod writes, implementing optimistic non-blocking mutations, save indicators, rollback after failure, debounced teardown flushes, or guarding stale writes from clobbering newer edits.
- License 许可
- MIT
- 所属仓库
- jeswr/solid-sdk
- 最近更新
- 2026-11-15
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- solid-optimistic-ui
- description
- Use when Solid app interactions block on pod writes, implementing optimistic non-blocking mutations, save indicators, rollback after failure, debounced teardown flushes, or guarding stale writes from clobbering newer edits.
03 SKILL.md 正文
Quick reference
<!-- AUTHORED-BY Codex GPT-5 -->
Make pod mutations optimistic
Update local UI state first, persist asynchronously, reconcile in the background, and expose a small non-blocking saving state.
Correct rollback
Capture both the original fields and the optimistic result.
- Revert only fields changed by the failed mutation, applied to the current record. Replacing the whole record can discard unrelated edits made while the request was in flight.
- Revert only if the current value still matches that mutation's optimistic value or mutation ID. A late failure must not undo a newer edit to the same field.
- If the record was deleted or superseded, drop the stale failure.
- Detect no-op changes before entering the saving state.
persist(write).catch(() => {
setItems((current) => revertChangedFieldsIfStillCurrent(current, mutation));
});
Persistence lifecycle
- Keep optimistic state in the durable, WebID-scoped cache so a reload during a write does not resurrect older state.
- Reconcile after success because a server-side write may update coupled fields.
- Generation-fence refreshes so an older response cannot overwrite newer local or server state.
- For debounced writes, flush on
visibilitychangeto hidden andpagehide. - Use
fetch(..., { keepalive: true })only when the encoded body fits the browser's keepalive budget; otherwise fall back to a normal best-effort fetch. - Single-flight duplicate teardown flushes for the same snapshot, but do not coalesce a keepalive flush onto a normal fetch that teardown can cancel.
- Clear the durable pending marker only after the write resolves; retain it for retry after failure.
Use role="status" and aria-live="polite" for Saving/Saved/Error feedback. Avoid modal progress and avoid blocking the user's next action.
Agent persona
When this work is delegated to a sub-agent, spawn the solid-frontend-dev persona from
.claude/agents/solid-frontend-dev.md — it routes through this skill.
Orchestration: .claude/agents/solid-app-orchestration.md.
<!-- AUTHORED-BY Codex GPT-6.1-Sol -->
Detailed patterns
Read solid-app-shell for the detailed source behind this
quick reference: field-scoped rollback, mutation ownership, teardown flushes,
save indicators, and background reconciliation. The original detailed source is
named solid-app-shell; both existing skill names remain discoverable.
04 同仓库更多 Skills
storage-conformance
Work on @jeswr/storage-conformance, the shared storage conformance suite package in the Solid SDK workspace.
fetch-rdf-engine-tests
Maintain fetch-rdf's real Node WASM parser integration tests without introducing a reverse engine dependency in fetch-rdf.
alpha
Use when checking fixtures, including folded YAML descriptions.
widget
Use when testing package skills: YAML quoting works.
web-seo
Use when improving technical and entity SEO for a modern personal, portfolio, documentation, or marketing site, including crawlable HTML, canonical metadata, sitemap and robots, Person/ProfilePage JSON-LD, Core Web Vitals, and honest ranking expectations.
solid-wac
Use when implementing or auditing Solid server WAC authorization, ACL creation and inheritance, auxiliary-resource escalation, method-to-mode mapping, 401 versus 403 challenges, WAC-Allow, or defensive typed ACL parsing with @solid/object and @rdfjs/wrapper.