Skip to content

fix(webapp,react-hooks): enforce stable hook ordering - #4688

Open
carderne wants to merge 2 commits into
mainfrom
fix/webapp-react-hook-order-lint-tri-13381
Open

fix(webapp,react-hooks): enforce stable hook ordering#4688
carderne wants to merge 2 commits into
mainfrom
fix/webapp-react-hook-order-lint-tri-13381

Conversation

@carderne

@carderne carderne commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Enforce stable React hook ordering in the dashboard and React hooks package.

Conditional hook calls now keep a consistent order, and overloaded realtime stream arguments are resolved before entering the shared hook implementation.

Base: main

@carderne carderne changed the title fix/webapp react hook order lint tri 13381 fix(webapp,react-hooks): enforce stable hook ordering Aug 19, 2026
@changeset-bot

changeset-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d0d985e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7fcbb3b4-41aa-45ba-8938-aa855902d29c

📥 Commits

Reviewing files that changed from the base of the PR and between c6d0621 and c451fd8.

📒 Files selected for processing (1)
  • .oxlintrc.json

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (25)
  • GitHub Check: report
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (1, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (8, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (9, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (3, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (6, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (5, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (12, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (11, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (2, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (7, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (10, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (4, 12)
  • GitHub Check: internal / 🧪 Unit Tests: Internal
  • GitHub Check: e2e-webapp / 🧪 E2E Tests: Webapp
  • GitHub Check: packages / 🧪 Unit Tests: Packages (3, 3)
  • GitHub Check: fk-cascade-guard / fk-cascade-guard
  • GitHub Check: obsmap / 🧪 Unit Tests: Observability Map
  • GitHub Check: packages / 🧪 Unit Tests: Packages (1, 3)
  • GitHub Check: packages / 🧪 Unit Tests: Packages (2, 3)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: runops-guard / runops-guard
  • GitHub Check: code-quality / code-quality
  • GitHub Check: audit
  • GitHub Check: Analyze (javascript-typescript)
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2026-04-13T21:43:58.707Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3368
File: apps/webapp/app/services/taskIdentifierRegistry.server.ts:49-58
Timestamp: 2026-04-13T21:43:58.707Z
Learning: In `apps/webapp/app/services/taskIdentifierRegistry.server.ts` (and closely related task registry/sync code in this module), an empty deployment (zero tasks) is not a realistic/expected scenario. Do not flag or require special handling or fallback logic for missing empty-task cases in this registry/sync flow.

Applied to files:

  • .oxlintrc.json
📚 Learning: 2026-04-23T13:26:27.529Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3430
File: apps/webapp/app/presenters/v3/RunStreamPresenter.server.ts:0-0
Timestamp: 2026-04-23T13:26:27.529Z
Learning: In this codebase’s SSE implementation (notably `apps/webapp/app/utils/sse.ts` and its SSE callers such as `apps/webapp/app/presenters/v3/RunStreamPresenter.server.ts`), do not treat `.abort()` vs `.abort("<reason string>")` differences as a heap retention/memory leak issue on Node 20. Heap deltas are identical once `AbortSignal.any` is not involved; the investigated SSE memory leak root cause was `AbortSignal.any` (via FinalizationRegistry behavior on abort). When reviewing, focus on whether `AbortSignal.any` (or similar signal-combining/finalization patterns) is used in the SSE abort path rather than the presence/contents of the abort reason string. Named abort-reason sentinel constants (e.g., `ABORT_REASON_*`) are for readability/style only, not correctness.

Applied to files:

  • .oxlintrc.json
📚 Learning: 2026-04-30T21:28:35.705Z
Learnt from: samejr
Repo: triggerdotdev/trigger.dev PR: 3473
File: internal-packages/database/prisma/schema.prisma:59-60
Timestamp: 2026-04-30T21:28:35.705Z
Learning: In this repo, session-duration lower-bound validation is intentionally enforced only at the app layer (via `isAllowedSessionDuration` and `SESSION_DURATION_OPTIONS`), where the minimum allowed value is 300 seconds (5 minutes). `User.sessionDuration` is `Int` (non-nullable) and `Organization.maxSessionDuration` is `Int?` (nullable). There are currently no DB-level `CHECK` constraints for these fields anywhere in the migrations, so future reviews should not flag the absence of DB `CHECK` constraints on these session-duration fields—focus validation on the app-layer logic instead.

Applied to files:

  • .oxlintrc.json
📚 Learning: 2026-05-12T06:43:09.116Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3558
File: internal-packages/run-engine/src/run-queue/index.ts:420-424
Timestamp: 2026-05-12T06:43:09.116Z
Learning: In internal-packages/run-engine/src/run-queue/index.ts, the RunQueue “read-path” counter/concurrency methods (e.g., lengthOfQueue/lengthOfQueues/currentConcurrencyOfQueues) intentionally “fail open” on transient Redis pipeline result errors. If you see pipeline result errors (e.g., baseErr/ctrErr) being coerced to 0 (treating Redis command errors the same as missing keys) rather than surfaced/thrown, do not flag it as a bug and do not suggest propagating those errors in future reviews.

Applied to files:

  • .oxlintrc.json
📚 Learning: 2026-05-19T21:04:49.990Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3671
File: packages/trigger-sdk/src/v3/ai.ts:724-769
Timestamp: 2026-05-19T21:04:49.990Z
Learning: In packages/trigger-sdk/src/v3/ai.ts, when reviewing recovery/replay of turns, do NOT flag “lost metadata on recovered turns” if the recovered turns are reconstructed via the recovery boot queue that maps metadata by message.id (using replaySessionInTail’s {message, metadata, seqNum} per session.in record). If a message has no matching session.in record (e.g., hook-synthesized messages), the code intentionally falls back to the current boot payload’s metadata—this fallback is expected behavior.

Applied to files:

  • .oxlintrc.json
🔇 Additional comments (1)
.oxlintrc.json (1)

48-49: LGTM!

Also applies to: 118-128


Walkthrough

The changes enable React rules-of-hooks lint checks for application and react-hooks source files. Shortcut hooks now run unconditionally in Switch and TextLink. useRealtimeStream normalizes overload arguments before one implementation call. TraceView now requires non-null trace data. The task route guards queue loading and queue derivation with foundTask before rendering the not-found state.

Merge Risk: ⚪ Minimal · up to c451f

The hook-ordering changes present no actionable merge-blocking risk in the supplied evidence, so the PR is merge-ready after normal checks and review.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides a relevant summary but omits the required issue reference, checklist, testing details, changelog, and screenshots sections. Add the required template sections and provide the issue reference, checklist status, testing steps, changelog entry, and screenshot information.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: enforcing stable hook ordering in the webapp and React hooks package.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/webapp-react-hook-order-lint-tri-13381

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

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Aug 19, 2026

Copy link
Copy Markdown

Open in StackBlitz

@trigger.dev/build

npm i https://pkg.pr.new/@trigger.dev/build@d0d985e

trigger.dev

npm i https://pkg.pr.new/trigger.dev@d0d985e

@trigger.dev/core

npm i https://pkg.pr.new/@trigger.dev/core@d0d985e

@trigger.dev/python

npm i https://pkg.pr.new/@trigger.dev/python@d0d985e

@trigger.dev/react-hooks

npm i https://pkg.pr.new/@trigger.dev/react-hooks@d0d985e

@trigger.dev/redis-worker

npm i https://pkg.pr.new/@trigger.dev/redis-worker@d0d985e

@trigger.dev/rsc

npm i https://pkg.pr.new/@trigger.dev/rsc@d0d985e

@trigger.dev/schema-to-json

npm i https://pkg.pr.new/@trigger.dev/schema-to-json@d0d985e

@trigger.dev/sdk

npm i https://pkg.pr.new/@trigger.dev/sdk@d0d985e

commit: d0d985e

@carderne
carderne marked this pull request as ready for review August 19, 2026 11:23
devin-ai-integration[bot]

This comment was marked as resolved.

@carderne
carderne force-pushed the fix/webapp-react-hook-order-lint-tri-13381 branch from c451fd8 to d0d985e Compare August 19, 2026 14:53

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

Open in Devin Review

Comment thread .oxlintrc.json
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