Skip to content

0012 — React Compiler lint rules disabled (oxlint 1.79)

Status: candidate Opened: 2026-08-21 · Area: frontend (apps/admin-console, apps/learner-web, apps/teacher-portal) · Config: .oxlintrc.jsonc Reopen trigger: adopting the React Compiler for real (the babel plugin / react-compiler-runtime in an app build), a bug traced to one of the flagged patterns (a cascading-render loop, a stale ref read, an expired clock value rendered as live), or a deliberate slice of frontend work in one of the listed areas — convert that area’s sites and re-enable the rule for it.

The oxlint ^1.78 → ^1.79 bump (2026-08-21, part of the routine dependency update) promoted the React Compiler diagnostics into oxlint’s default react rule set. This config did not change; the rule set did. With options.denyWarnings: true every one of them is fatal, so bun run lint went from green to 67 diagnostics across 42 files in all three frontend apps on a bump that touched no application code.

Five rules are set to "off" in .oxlintrc.jsonc with a pointer to this item:

Rule Sites What the code is doing
react/set-state-in-effect 40 fetch-on-mount loaders and reset-on-input-change effects
react/refs 23 latest-callback refs written in render, plus deliberate memo-backed identity caches
react/purity 2 deliberately unmemoised Date.now() for clock work
react/globals 1 a test probe writing a module-level capture from a render
react/static-components 1 a component defined inside another component

Most of the 67 are established idioms, not defects, and the rules’ prescribed cure (“derive during render, initialize state directly”) does not apply to a fetch-on-mount loader — the honest fix is to restructure the data-loading layer around a request key. Doing that blind, in three apps, inside a dependency-bump commit, trades a lint-clean tree for unreviewed behavioural change across 42 files. Some of the flagged code is also deliberate and comment-documented against exactly the change the rule would push (see the purity sites below).

set-state-in-effect — fetch-on-mount loaders (~14). An effect kicks off an async load whose first synchronous statement flips a loading flag: void load() / void loadQueues() / void loadSessions() in the teacher-portal tabs and modals and the admin-console panels; setIsLoading(true) in LtiToolAgsPublicationsPanel, LtiToolNrpsSnapshotsPanel, EdcDetailModal, oauth.authorize; setState({ status: "loading" }) in the four viewport hosts (WebContentHost, MediaHost, LaunchedContentHost, DocumentHost); retryActivation() in use-cat-session-state, use-secure-assessment-state, use-item-bank, use-roster-invites. A real conversion means state derived from a request key (or a fetching layer that owns it), not a local edit.

set-state-in-effect — reset/re-anchor on input change (~20). resetForm() (ResourceCatalogPanel), setForm(empty…) (IssuerProfilePanel, PnpProfilePanel), setSelectedOfferingId(null) and the role/scope defaults (InvitePanel, four sites), setSuccessMessage(null) / setErrorMessage(null) and the selection re-anchor (AchievementImagePanel), setSelectedOrganizationId (admin-console/src/routes/index.tsx), setBackfillOrganizationId (Cmi5BackfillPanel), setLang(null) (EdcDetailModal), setSelectedIndex(null) (ViewportWidget), setElement(null) (GraphicShapeEditor), setSessions([]) (LtiPlatformProctoringPanel), and the lti.content / assessments / wallet.connections.callback route resets. React’s documented cures are the key remount or the adjust-state-during-render comparison; which one fits differs per site.

refs — latest-callback refs (mechanical, ~10). onXRef.current = onX written in render: DocumentReaderHost (four callbacks), the three features/sync/lib/sync.tsx copies, TestStructureEditor. These convert cleanly to useEffectEvent (React 19.2) — packages/ui’s useSignedOutTransition and @conform-ed/qti-react’s DrawingReferenceSkin were converted this way on 2026-08-21 and are the worked examples. This is the cheapest slice and the one to take first.

refs — deliberate identity caches (~6). The content-stable-previous pattern: a useMemo that reads and writes a cache ref to keep object identity stable across deliveries — use-assessment-item-versions.ts, use-secure-assessment-state.ts, pci-modules.ts. Each carries a comment saying so. The compiler genuinely forbids ref access in render; keeping the identity guarantee without a ref needs a design answer, not a rewrite.

purity (2). Date.now() evaluated on every render, deliberately not memoised, in DiscussionModerationPanel and use-offering-discussions — the comment states the reason: a now frozen at subscribe time or at the last row delivery leaves an expired posting mute badged as in force for the rest of the session. A fix must supply a real clock (a ticking source / useSyncExternalStore), not memoisation.

globals (1). use-unit-viewport-content.test.tsx — a test probe component assigning to a module-level observed from its render. Test-only; either restructure the probe or scope the rule off for tests.

static-components (1). RootZone defined inside TestStructureEditor and rendered as <RootZone />, so it remounts on every parent render. The smallest genuine defect in the list.

  1. react/refs latest-callback sites → useEffectEvent, then re-enable nothing yet (the identity-cache sites still trip the rule).
  2. react/static-components — one component, hoist it.
  3. react/set-state-in-effect reset-on-input-change sites, app by app.
  4. The fetch-on-mount loaders — needs the data-loading decision first; the largest slice.
  5. react/purity and the identity caches — design answers (a clock source; identity stability without a render-time ref), worth their own grilling before code.

Re-enable each rule in .oxlintrc.jsonc as its last site is converted, so the burn-down cannot regress.