Skip to content

Conversation

@pulpdrew
Copy link
Contributor

Closes HDX-3125
Closes HDX-3126

Summary

This PR fixes two application crashes due to infinite render loops: useQueryState value updates --> set form values --> trigger form's useWatch/watch --> triggers useEffect --> calls setQueryState --> repeat....

In these cases, the fix is to compare useWatch values to the previous useWatch value (using usePrevious) and only call setQueryState when the form value has changed. Before, the useEffect was also called when the query state changes.

@changeset-bot
Copy link

changeset-bot bot commented Dec 30, 2025

🦋 Changeset detected

Latest commit: 03bc47e

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

This PR includes changesets to release 2 packages
Name Type
@hyperdx/app Patch
@hyperdx/api 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

@vercel
Copy link

vercel bot commented Dec 30, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
hyperdx-v2-oss-app Ready Ready Preview, Comment Dec 30, 2025 4:04pm

@claude
Copy link

claude bot commented Dec 30, 2025

PR Review

✅ No critical issues found.

The fix properly addresses infinite render loops by using usePrevious to track previous values and only triggering updates when the watched form values actually change (not when query state changes).

Minor observations:

  • ⚠️ Potential first-render issue: usePrevious returns undefined on first render. The comparisons previousWatchedConnection !== watchedConnection and sourceId != previousSourceId will be true on mount, triggering setConnection/onSubmit even when values haven't changed from their initial state. Consider adding previousValue !== undefined guards if this causes unwanted initial submissions.
  • ℹ️ Uses loose equality (!=) in ServicesDashboardPage vs strict equality (!==) in ClickhousePage - inconsistent but not critical since comparing primitives.

Pattern is sound for breaking the render loop. Good job including comments explaining why appliedConfig.source and appliedConfig.service are excluded from deps.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 30, 2025

E2E Test Results

All tests passed • 51 passed • 5 skipped • 702s

Status Count
✅ Passed 51
❌ Failed 0
⚠️ Flaky 1
⏭️ Skipped 5

Tests ran across 4 shards in parallel.

View full report →

@pulpdrew pulpdrew requested review from a team and teeohhem and removed request for a team December 30, 2025 15:45
@kodiakhq kodiakhq bot merged commit 4889205 into main Dec 30, 2025
12 checks passed
@kodiakhq kodiakhq bot deleted the drew/fix-dashboard-crashes branch December 30, 2025 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants