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
myftija pushed a commit that referenced this pull request Dec 5, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.


# Releases
## trigger.dev@4.2.0

### Minor Changes

- feat(cli): upgrade bun deployments to v1.3.3
([#2756](#2756))

### Patch Changes

- fix(otel): exported logs and spans will now have matching trace IDs
([#2724](#2724))
- The `--force-local-build` flag is now renamed to just `--local-build`
([#2702](#2702))
- fix(cli): header will always print the correct profile
([#2728](#2728))
- feat: add ability to set custom resource properties through
trigger.config.ts or via the OTEL_RESOURCE_ATTRIBUTES env var
([#2704](#2704))
- feat(cli): implements content-addressable store for the dev CLI build
outputs, reducing disk usage
([#2725](#2725))
- Added support for native build server builds in the deploy command
(`--native-build-server`)
([#2702](#2702))
-   Updated dependencies:
    -   `@trigger.dev/build@4.2.0`
    -   `@trigger.dev/core@4.2.0`
    -   `@trigger.dev/schema-to-json@4.2.0`

## @trigger.dev/build@4.2.0

### Patch Changes

- syncVercelEnvVars to skip API and read env vars directly from
env.process for Vercel build environments. New syncNeonEnvVars build
extension for syncing environment variablesfrom Neon database projects
to Trigger.dev. The extension automatically detects branches and builds
appropriate PostgreSQL connection strings for non-production, non-dev
environments (staging, preview).
([#2729](#2729))
-   Updated dependencies:
    -   `@trigger.dev/core@4.2.0`

## @trigger.dev/core@4.2.0

### Patch Changes

- fix: prevent ERR_IPC_CHANNEL_CLOSED errors from causing an unhandled
exception on TaskRunProcess
([#2743](#2743))
- Added support for native build server builds in the deploy command
(`--native-build-server`)
([#2702](#2702))

## @trigger.dev/python@4.2.0

### Patch Changes

-   Updated dependencies:
    -   `@trigger.dev/build@4.2.0`
    -   `@trigger.dev/sdk@4.2.0`
    -   `@trigger.dev/core@4.2.0`

## @trigger.dev/react-hooks@4.2.0

### Patch Changes

- fix: prevent infinite useEffect when passing an array of tags to
useRealtimeRunsWithTag
([#2705](#2705))
-   Updated dependencies:
    -   `@trigger.dev/core@4.2.0`

## @trigger.dev/redis-worker@4.2.0

### Patch Changes

-   Updated dependencies:
    -   `@trigger.dev/core@4.2.0`

## @trigger.dev/rsc@4.2.0

### Patch Changes

-   Updated dependencies:
    -   `@trigger.dev/core@4.2.0`

## @trigger.dev/schema-to-json@4.2.0

### Patch Changes

-   Updated dependencies:
    -   `@trigger.dev/core@4.2.0`

## @trigger.dev/sdk@4.2.0

### Patch Changes

- fix(sdk): Re-export schemaTask types to prevent the TypeScript error
TS2742: The inferred type of 'task' cannot be named without a reference
to '@trigger.dev/core/v3'. This is likely not portable.
([#2735](#2735))
- feat: add ability to set custom resource properties through
trigger.config.ts or via the OTEL_RESOURCE_ATTRIBUTES env var
([#2704](#2704))
-   Updated dependencies:
    -   `@trigger.dev/core@4.2.0`

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.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.

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

3 participants