## Why The processor/portal loads slowly because every view fetches its data on mount with no client-side cache — navigating away and back refetches everything, and shared data (policies, sources, roster, fleet stats) is fetched repeatedly. This adopts **TanStack Query** so the portal caches, dedupes, and revalidates instead. Follows the Users-page proof-of-concept (kept as the reference A/B example behind a dev flag); DevTools before/after confirmed revisiting a cached view now costs zero network calls. ## What **Shared per-resource query layer** (`portal/queries/`) — the mechanism for both in-view and cross-view sharing: - `keys.ts` (flavor-agnostic queryKey factory), `adapters.ts` (`toAsyncState` → the existing `AsyncState` shape, so view bodies barely change) - One **base hook per endpoint**; **derived hooks** (`usePoliciesOverview`, `useProcessorFlow`, `useOnboardingProgress`) compose them - The bundle functions (`fetchPolicies`, `fetchProcessorFlow`, `useOnboardingProgress`) are decomposed into base queries — otherwise the caches wouldn't dedupe against each other **Migrated:** Documents, Policies, Pipelines, Sources + all of Home's fetching cards. Mutations use `invalidateQueries` (Policies' `version` bump removed; Source/Pipeline builders invalidate-then-navigate; ConnectionsTab + S3 picker share one cache). **SaaS `/team/my` collapse:** `resolveTeam()` reads through the shared cache (`ensureQueryData`), so roster + teams resolve it once (2→1), with a direct-fetch fallback when no provider is mounted. `QueryClientProvider` is mounted once at the portal root (`PortalApp`), above the router, so the cache survives navigation. ## Impact on duplicate fetches - **In-view:** Home `/policies` ×3, `/policies/runs` ×3, `/sources` ×2, `/v1/editor/deployment` ×2 → **1× each** per mount - **Cross-view:** Policies / Sources / Users / EditorAdmin / Infrastructure reuse Home's warmed cache within `staleTime` (no refetch on navigation) - **SaaS Users:** `/team/my` 2× → **1×** ## Testing - Portal typecheck + SaaS typecheck, ESLint (`--max-warnings=0`), Prettier — all green - **224 portal tests pass** (existing component tests wrapped in a shared `QueryClient` test provider) - New: `queries/sharing.test.tsx` (in-view: 3 consumers → 1 fetch each; cross-view: remount → 0 refetch) and a `/team/my` collapse assertion in `UsersReactQuery.test.tsx` ## Notes for reviewers - Keys are intentionally flavor-agnostic (local vs SaaS routing lives inside the api fns), so one key addresses whichever backend the flavor build resolves. - `staleTime` 30s / `gcTime` 5m defaults; tier-dependent resources key on tier. - Users view keeps its dev flag/legacy path deliberately as the documented reference.
Stirling PDF - The Open-Source PDF Platform
Stirling PDF is a powerful, open-source PDF editing platform. Run it as a personal desktop app, in the browser, or deploy it on your own servers with a private API. Edit, sign, redact, convert, and automate PDFs without sending documents to external services.
Key Capabilities
- Everywhere you work - Desktop client, browser UI, and self-hosted server with a private API.
- 50+ PDF tools - Edit, merge, split, sign, redact, convert, OCR, compress, and more.
- Automation & workflows - No-code pipelines direct in UI with APIs to process millions of PDFs.
- Enterprise‑grade - SSO, auditing, and flexible on‑prem deployments.
- Developer platform - REST APIs available for nearly all tools to integrate into your existing systems.
- Global UI - Interface available in 40+ languages.
For a full feature list, see the docs: https://docs.stirlingpdf.com
Quick Start
docker run -p 8080:8080 docker.stirlingpdf.com/stirlingtools/stirling-pdf
Then open: http://localhost:8080
For full installation options (including desktop and Kubernetes), see our Documentation Guide.
Resources
Support
- Community: Discord
- Bug Reports: GitHub Issues
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
This project uses Task as a unified command runner for all build, dev, and test commands. Run task dev to get started running the editor, run task to see the most common commands, or see the Developer Guide for full details.
For adding translations, see the Translation Guide.
License
Stirling PDF is open-core. See LICENSE for details.

