Skip to content

UI: render with TanStack Redact instead of React DOM - #50

Merged
firsttris merged 1 commit into
mainfrom
redact
Nov 4, 2026
Merged

firsttris merged 1 commit into
mainfrom
redact

Conversation

@firsttris

Copy link
Copy Markdown
Owner

What and why

The web UI (ui/) now renders with TanStack Redact instead of React DOM. Redact is a smaller runtime with React 19's API. The code keeps importing from react; redact() from @tanstack/redact/vite, added after react() in ui/vite.config.ts, points those imports to Redact at build time and in vite dev. The goal is less JavaScript for the first load.

  • @tanstack/redact is pinned to exactly 0.3.1 in ui/package.json.
  • The UI is a plain Vite app, not TanStack Start, so no ssr.noExternal is needed.
  • The stack lines in README.md, docs/architecture.md and docs/development.md now mention Redact.

Release age: 0.3.1 was younger than the one-day minimumReleaseAge in bunfig.toml when it was added. For this manual update the check was skipped once (bun add --exact --minimum-release-age=0), on the maintainer's instruction that the rule is meant for Renovate. bunfig.toml is unchanged, and bun install --frozen-lockfile works without the flag.

Size (gzip -9, ui/dist)

React DOM Redact Change
Initial JS (entry + modulepreloads in index.html) 126,874 B (123.9 KiB) 79,998 B (78.1 KiB) −36.9 %
All client JS (dist/assets/*.js) 151,043 B (147.5 KiB) 103,869 B (101.4 KiB) −31.2 %

Checks run locally

Check React (main) Redact (this branch)
bun run typecheck ✅ ✅
bun run test (221 tests) ✅ ✅
bun run build ✅ ✅
cargo fmt --all --check ✅ ✅
cargo clippy --workspace --all-targets -- -D warnings ✅ ✅
cargo test --workspace (91 tests) ✅ ✅
mkdocs build --strict – ✅
Playwright smoke test against the built UI served by haul ✅ ✅
Same smoke test against vite dev (proxy to haul) – ✅
shellcheck scripts/install.sh not installed locally; this PR doesn't touch the script

The repo has no e2e suite in CI, and bun run screenshots needs 7z and fixed ports. The smoke test was a throwaway Playwright script that is not committed. It started a fresh haul debug build and logged in. Then it clicked through every navigation link, loaded /, /linksammler, /fertig, /accounts and /einstellungen directly, and failed on any page error or console error. Neither runtime produced an error, and the screenshots of the two runtimes look the same. In dev mode, src/main.tsx imports @tanstack/redact/dist/... in place of react/react-dom.

Risks

  • Redact renders synchronously, so useTransition/useDeferredValue don't run concurrently. A grep of ui/src for useTransition, useDeferredValue, startTransition, Suspense, class components, flushSync and createPortal finds nothing.
  • The only camelCase SVG attributes are strokeWidth, strokeLinecap and strokeLinejoin (ui/src/components/icons.tsx, ui/src/routes/Downloads.tsx). Redact hyphenates the stroke* family, and the icons render as before.
  • Redact is at 0.x. The libraries still compile against @types/react and use React 19's public API. A future TanStack Router, Query or Table release that relies on something Redact lacks would show up when Renovate updates them.
  • Only the UI uses React. The browser extension (extension/) doesn't use React, so it is unaffected.

Rollback

Remove redact() and its import from ui/vite.config.ts, which brings back React DOM. Then drop @tanstack/redact from ui/package.json with bun remove --cwd ui @tanstack/redact, or revert this commit.


Generated by Claude Code

The code keeps importing from react; the Vite plugin of @tanstack/redact
(pinned to 0.3.1) points those imports to Redact at build and in dev.
Initial JS shrinks from 124 to 78 KiB gzip, all client JS from 148 to 101 KiB.
The UI uses no concurrent features (useTransition, Suspense, ...), so
Redact's synchronous rendering changes nothing for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y3rdfbVn9WQaWcUTzwvU2s
@firsttris
firsttris merged commit e5c2eb6 into main Nov 4, 2026
3 checks passed
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