Skip to content

Conversation

@ericallam
Copy link
Member

@ericallam ericallam commented Nov 24, 2025

fixes #2629

@changeset-bot
Copy link

changeset-bot bot commented Nov 24, 2025

🦋 Changeset detected

Latest commit: 3f0efbf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 25 packages
Name Type
@trigger.dev/react-hooks Patch
d3-chat Patch
references-d3-openai-agents Patch
references-nextjs-realtime Patch
references-realtime-hooks-test Patch
references-realtime-streams Patch
@trigger.dev/build Patch
@trigger.dev/core Patch
@trigger.dev/python Patch
@trigger.dev/redis-worker Patch
@trigger.dev/rsc Patch
@trigger.dev/schema-to-json Patch
@trigger.dev/sdk Patch
@trigger.dev/database Patch
@trigger.dev/otlp-importer Patch
trigger.dev Patch
@internal/cache Patch
@internal/clickhouse Patch
@internal/redis Patch
@internal/replication Patch
@internal/run-engine Patch
@internal/schedule-engine Patch
@internal/testcontainers Patch
@internal/tracing Patch
@internal/zod-worker Patch

Not sure what this means? Click here to learn what changesets are.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 24, 2025

Walkthrough

This PR adds a changeset entry and implements a fix for preventing infinite useEffect loops in the useRealtimeRunsWithTag hook when array-type tags are passed. The fix introduces a local normalization mechanism that joins tag arrays into a stable string representation using hyphens. This normalized string replaces the tag value in useEffect and useCallback dependency arrays, ensuring effects re-run when the logical tag changes without reacting to array reference changes. The original tag value remains unchanged for API calls.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Dependency array correctness: Verify that the normalized tag (hyphen-joined string) correctly captures semantic tag equality and prevents unnecessary re-runs
  • Edge cases: Confirm handling of empty arrays, single-element arrays, and tags containing hyphens or special characters
  • API contract preservation: Ensure the original tag value passed to processRealtimeRunsWithTag remains unaffected

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete and largely missing required sections from the template, including testing details, changelog, and checklist items. Fill out the PR template completely with: issue closure reference, completed checklist, testing steps, detailed changelog, and any relevant screenshots.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main fix: preventing infinite useEffect when passing an array of tags to useRealtimeRunsWithTag, which matches the changeset and code modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/use-realtime-runs-with-tag-infinite-effect

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6e47377 and 3f0efbf.

⛔ Files ignored due to path filters (30)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • references/realtime-hooks-test/.eslintrc.json is excluded by !references/**
  • references/realtime-hooks-test/.gitignore is excluded by !references/**
  • references/realtime-hooks-test/README.md is excluded by !references/**
  • references/realtime-hooks-test/next.config.ts is excluded by !references/**
  • references/realtime-hooks-test/package.json is excluded by !references/**
  • references/realtime-hooks-test/postcss.config.mjs is excluded by !references/**
  • references/realtime-hooks-test/public/.gitkeep is excluded by !references/**
  • references/realtime-hooks-test/src/app/actions.ts is excluded by !references/**
  • references/realtime-hooks-test/src/app/batch/[id]/page.tsx is excluded by !references/**
  • references/realtime-hooks-test/src/app/globals.css is excluded by !references/**
  • references/realtime-hooks-test/src/app/layout.tsx is excluded by !references/**
  • references/realtime-hooks-test/src/app/page.tsx is excluded by !references/**
  • references/realtime-hooks-test/src/app/run-with-streams/[id]/page.tsx is excluded by !references/**
  • references/realtime-hooks-test/src/app/run/[id]/page.tsx is excluded by !references/**
  • references/realtime-hooks-test/src/app/runs-with-tag/[tag]/page.tsx is excluded by !references/**
  • references/realtime-hooks-test/src/app/stream/[id]/page.tsx is excluded by !references/**
  • references/realtime-hooks-test/src/components/batch-viewer.tsx is excluded by !references/**
  • references/realtime-hooks-test/src/components/run-viewer.tsx is excluded by !references/**
  • references/realtime-hooks-test/src/components/run-with-streams-viewer.tsx is excluded by !references/**
  • references/realtime-hooks-test/src/components/runs-with-tag-viewer.tsx is excluded by !references/**
  • references/realtime-hooks-test/src/components/stream-viewer.tsx is excluded by !references/**
  • references/realtime-hooks-test/src/trigger/batch-task.ts is excluded by !references/**
  • references/realtime-hooks-test/src/trigger/simple-task.ts is excluded by !references/**
  • references/realtime-hooks-test/src/trigger/stream-task.ts is excluded by !references/**
  • references/realtime-hooks-test/src/trigger/streams.ts is excluded by !references/**
  • references/realtime-hooks-test/src/trigger/tagged-task.ts is excluded by !references/**
  • references/realtime-hooks-test/tailwind.config.ts is excluded by !references/**
  • references/realtime-hooks-test/trigger.config.ts is excluded by !references/**
  • references/realtime-hooks-test/tsconfig.json is excluded by !references/**
📒 Files selected for processing (2)
  • .changeset/late-kings-smell.md (1 hunks)
  • packages/react-hooks/src/hooks/useRealtime.ts (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (23)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
.changeset/late-kings-smell.md (1)

1-5: LGTM!

The changeset correctly documents this bug fix as a patch release with an accurate description.

@ericallam ericallam merged commit f7240a9 into main Nov 24, 2025
31 checks passed
@ericallam ericallam deleted the fix/use-realtime-runs-with-tag-infinite-effect branch November 24, 2025 14:32
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.

bug: Infinite re-renders when using react hooks with tags

3 participants