Skip to content

fix(frontend): pass an explicit initial value to useRef so tsc passes on React 18 and 19 types - #344

Merged
hyperpolymath merged 3 commits into
mainfrom
claude/focused-meitner-uf53td
Nov 17, 2026
Merged

hyperpolymath merged 3 commits into
mainfrom
claude/focused-meitner-uf53td

Conversation

@hyperpolymath

@hyperpolymath hyperpolymath commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Change and reason

Dependabot's React bump (#332, react 18.3.1 to 19.3.1, @types/react 19.3.0) fails tsc && vite build with:

src/views/TreeView.tsx(186,21): error TS2554: Expected 1 arguments, but got 0.
src/views/TreeView.tsx(231,23): error TS2554: Expected 1 arguments, but got 0.

React 19's types make the useRef argument required. useRef<number>() in TreeView.tsx (two places: saveTimer, scrollTimer) becomes useRef<number | undefined>(undefined), which typechecks on React 18 and 19 types and behaves the same at runtime. A search of frontend/src found no other argument-less useRef/createRef. Same forward-compatible preparation as #342 and #343.

Validation

Bun 1.4.4, bun install --frozen-lockfile --ignore-scripts, in frontend/:

  • Baseline (unchanged tree, React 18): bun run build passes, bun run typecheck passes, bun test src 90 pass / 0 fail.
  • After the change (React 18): build passes (built in 34.45s), typecheck passes, 90 pass / 0 fail.
  • React 19 in a scratch copy outside the repo (react and react-dom 19.3.1, @types/react 19.3.0, @types/react-dom 19.3.0), nothing committed:
    • Unfixed source (negative control): tsc reproduces exactly the two TS2554 errors above; tests 90 pass / 0 fail.
    • Fixed source: bun run build passes (built in 20.22s), tests 90 pass / 0 fail.

Not run: Julia and R jobs (this change touches one frontend file); CI on this PR covers them. scripts/lint-sonar-reliability.sh and SonarCloud were not run locally.

Scope

One file, two lines. No package.json or lockfile change; the React bump itself stays in #332.

Contribution checks

  • I followed CONTRIBUTING.md.
  • This branch starts at current main (6bb2ad2) and contains no merges from fork main.
  • CI has run and passes.
  • Existing licensing, citation and acknowledgement text is unchanged.

Generated by Claude Code

CI/gate

The account ruleset "Branch-Floor" requires a status check named exactly CI/gate; this repository never emitted it. Commit 6ca65cc adds one job to .github/workflows/ci.yml: id ci-status, name: CI/gate, needs all seven other jobs (denominator 7), if: always(), permissions: {}, pure run: shell (no uses:, nothing new to pin). No trigger, path filter, existing job or check name was changed. The branch still starts at the tip of origin/main (6bb2ad2) with no merge commits; no rebase was needed.

Rules, from the if: conditions in the file:

  • gate and occupancy_gate (detectors) must be success.
  • test, standards, agda are governed by gate: success when gate succeeded with relevant == 'true', skipped only when gate succeeded with relevant == 'false'.
  • occupancy, disagreement are governed by occupancy_gate in the same way.
  • A skip while the detector failed, was cancelled, was skipped, or gave no usable output fails the gate. failure, cancelled, empty or unknown results exit 1.
  • A table of job, result, expected, verdict goes to the log and $GITHUB_STEP_SUMMARY.

Local evidence (decision script extracted from the YAML, run with NEEDS_JSON set by hand; jq):

  • all success, both detectors relevant: exit 0
  • agda failure: exit 1
  • test cancelled: exit 1
  • designed skip (both detectors success, relevant false, five jobs skipped): exit 0
  • skips with gate failed: exit 1
  • skips with gate skipped: exit 1
  • detector says relevant but job skipped: exit 1
  • unknown result weird: exit 1
  • empty needs: exit 1

YAML parsed with Bun's YAML parser: the new job's name, needs and the unchanged on: block were read back correctly.

NOT RUN: the repository's Julia test test/unit/test_install_pins.jl (no Julia here; by reading it, CI/gate has no ${{ and no matrix, so it should hold), actionlint (not installed).

Summary by CodeRabbit

  • CI
    • Added a required status check that verifies relevance gates and governed job results, and reports a summary of the outcomes.
  • Refactor
    • No user-visible behavior changes.

… on React 18 and 19 types

React 19's @types/react makes the argument of useRef required, so
useRef<number>() in TreeView.tsx fails with TS2554 (Dependabot #332).
useRef<number | undefined>(undefined) typechecks on both 18 and 19 and
keeps the same runtime behaviour. No other argument-less useRef in src.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDiW8qD4f2JDQJ4buGo
Copilot AI balanced review requested due to automatic review settings November 16, 2026 22:54
@linear-code
linear-code Bot marked this pull request as ready for review November 16, 2026 22:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 45 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 6ca65cc and dab6c85.

Files selected for processing: 1

  • .github/workflows/ci.yml

No actionable comments were generated in the recent review.

Walkthrough

The workflow adds a CI/gate job to validate detector and governed-job results. In TreeView, two timer refs now explicitly include undefined in their types.

Changes: CI status gate

Layer / File(s) Summary
Aggregate CI results
.github/workflows/ci.yml
The always-running CI/gate job checks both detectors and the five governed jobs against expected results. It records actual and expected results in the step summary and fails when any result is unexpected.

TreeView timer ref types

Layer / File(s) Summary
Update timer ref types
frontend/src/views/TreeView.tsx
The saveTimer and scrollTimer refs now use the type number | undefined. Their scheduling and cleanup logic is unchanged.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: joshuajewell

Merge Risk: Minimal · previous review 6ca65

This change makes two timer refs in TreeView compatible with React 19's required useRef argument without changing runtime behavior, and adds a CI/gate aggregation check. No concrete merge-blocking risk was identified; CI should still be confirmed passing before merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the change: passing an explicit initial value to useRef so that tsc passes with React 18 and 19 types. It is specific to the frontend change and matches the one-file diff in TreeView.t…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is thorough and covers the template sections. Change and reason: the PR changes two argument-less useRef calls in TreeView.tsx to useRef<number | undefined>(undefined) to satisfy React…
Full details: Title check

Explanation

The title names the change: passing an explicit initial value to useRef so that tsc passes with React 18 and 19 types. It is specific to the frontend change and matches the one-file diff in TreeView.tsx. It also uses a conventional commit prefix, which is acceptable.

Full details: Description check

Explanation

The description is thorough and covers the template sections. Change and reason: the PR changes two argument-less useRef calls in TreeView.tsx to useRef<number | undefined>(undefined) to satisfy React 19 types, and it explains the TS2554 errors. Validation: Bun 1.4.4 commands were run on React 18 (build, typecheck, 90 tests passing) and in a scratch copy on React 19.3.1 (negative control reproduces the errors, fixed source builds and passes tests). It states that Julia, R, lint-sonar-reliability.sh, and SonarCloud were not run. Scope: one file, two lines, no lockfile change. Contribution checks are present. The description also includes a CI/gate section for the ci.yml change, which the template does not require. Its validation evidence is local only, and it notes that the Julia test and actionlint were not run. The CI checkbox is unchecked, which is consistent with CI not having run yet.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 6bb2ad2 and 6ca65cc.

Files selected for processing: 2

  • .github/workflows/ci.yml
  • frontend/src/views/TreeView.tsx

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDiW8qD4f2JDQJ4buGo
Copilot AI balanced review requested due to automatic review settings November 16, 2026 23:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

SonarCloud rule githubactions:S7679 flags $1 used directly in result and
relevant. Each is now assigned to a named local. No change in behaviour:
the gate's decision logic was re-run locally over seven cases (all success,
a failure, a cancellation, designed skips, skips with a failed detector, a
skip the detector did not allow, and mixed relevance) with the same exit
codes as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDiW8qD4f2JDQJ4buGo
Copilot AI balanced review requested due to automatic review settings November 16, 2026 23:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@sonarqubecloud

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath merged commit b2fe050 into main Nov 17, 2026
22 checks passed
@hyperpolymath
hyperpolymath deleted the claude/focused-meitner-uf53td branch November 17, 2026 00:07
hyperpolymath added a commit that referenced this pull request Nov 17, 2026
…ipt 7 together (#347)

## Change and reason

One change: the pending frontend upgrades applied together, replacing
five stale Dependabot PRs whose branches keep failing the
branch-freshness rule. Supersedes Dependabot PRs 332, 333, 334, 335 and
336 (they are not closed by this PR).

| Package | Before | After |
|---|---|---|
| vite | ^6.4.5 | ^8.3.7 (locked 8.3.7) |
| @vitejs/plugin-react | ^4.3.4 | ^6.3.0 |
| typescript | ^5.7.2 | ^7.0.2 |
| react-router-dom | ^6.30.6 | ^7.18.5 |
| react | ^18.3.1 | ^19.3.1 |
| react-dom | ^18.3.1 | ^19.3.1 (Dependabot's react PR left it on 18, a
runtime mismatch) |
| @types/react | ^18.3.18 | ^19.3.0 |
| @types/react-dom | ^18.3.5 | ^19.3.0 |

Source changes: none were needed. `frontend/vite.config.ts` already used
the function form of `manualChunks` and `useRef` already passes an
explicit initial value (#344). Only `frontend/package.json` and
`frontend/bun.lock` change. The lockfile change is needed because these
are dependency upgrades; it was regenerated with Bun 1.4.4. No test or
config pins the old frontend versions (grepped `test/`, `config/`,
`scripts/`, `.github/`).

## Validation

Bun 1.4.4, run in `frontend/` from a clean `node_modules` with `bun
install --frozen-lockfile --ignore-scripts`.

| Check | Baseline (main) | After |
|---|---|---|
| build (`tsc && vite build`) | pass | pass (Vite 8.3.7, 354 modules) |
| typecheck | pass | pass (TypeScript 7.0.2) |
| unit tests (`bun test src`) | 90 pass, 0 fail | 90 pass, 0 fail |
| `scripts/lint-sonar-reliability.sh` | not run | OK, no S2871 or S7758
findings |

Runtime smoke test (headless Chromium via Playwright, built `dist`
served with SPA fallback, API requests answered 503): 15 routes visited
by URL and 4 reached by clicking links.

| | Baseline | After |
|---|---|---|
| page errors | 0 | 0 |
| console errors (non-API) | 0 | 0 |
| routes with non-empty rendered content | 15 of 15 | 15 of 15, same
final paths and same text length on every route |
| click navigation (/studies, /jobs, /databases, /config) | same | same
|
| expected API failures (503) | 191 | 194 (polling timing jitter; all to
/api or /files) |

NOT RUN: the Julia and R test suites locally, and
`check-pr-freshness.sh` (the clone is shallow and the script refuses:
"shallow clone; check out with fetch-depth: 0"). By hand, the merge base
of HEAD and origin/main equals origin/main (e4e39aa), and the branch has
one commit and no merge commits.

## Scope

Left out: any source refactor, `.github/dependabot.yml`, and
CONTRIBUTING.md. Its "Settled decisions" section still says "React 18";
the owner decides whether to update it.

## Contribution checks

- [x] I followed [CONTRIBUTING.md](../CONTRIBUTING.md).
- [x] This branch starts at current upstream main and contains no merges
from fork main (checked by hand; the script could not run on the shallow
clone).
- [ ] CI has run and passes (pending).
- [x] Existing licensing, citation and acknowledgement text is
unchanged.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01J4QvDiW8qD4f2JDQJ4buGo)_

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Documentation**
* Frontend guidance now reflects React 19 while retaining the documented
choices for TypeScript, Vite, bun, and the frontend project location.
* **User-Facing Changes**
  * No changes to app features or behavior are described in this update.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

4 participants