fix(designer): Extract useRawInputsOutputs hook to fix portal freeze#9132
Merged
Elaina-Lee merged 1 commit intohotfix/v5.294from May 1, 2026
Merged
fix(designer): Extract useRawInputsOutputs hook to fix portal freeze#9132Elaina-Lee merged 1 commit intohotfix/v5.294from
Elaina-Lee merged 1 commit intohotfix/v5.294from
Conversation
…9129) The previous fix (inline placeholderData object) caused infinite re-renders in the portal because TanStack Query returns placeholderData as data immediately (isLoading=false), and a new inline object reference each render triggers the useEffect → dispatch → Redux update → re-render cycle endlessly. Fix: Port v2's useRawInputsOutputs hook pattern to v1: - Module-level emptyData constant (stable reference, no re-render loop) - Stable query key with actionTrackingId/startTime/endTime - No refetch() on runMetaData change (key change handles invalidation) - Always calls getActionLinks for fresh API data (no infinite nesting) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🤖 AI PR Validation ReportPR Review ResultsThank you for your submission! Here's detailed feedback on your PR title and body compliance:✅ PR Title
✅ Commit Type
✅ Risk Level
✅ What & Why
✅ Impact of Change
✅ Test Plan
✅ Contributors
|
| Section | Status | Recommendation |
|---|---|---|
| Title | ✅ | No change needed |
| Commit Type | ✅ | No change needed |
| Risk Level | ✅ | No change needed (matches risk:medium label) |
| What & Why | ✅ | No change needed |
| Impact of Change | ✅ | No change needed |
| Test Plan | ✅ | Unit tests present; manual testing explained |
| Contributors | ✅ | No change needed |
| Screenshots/Videos | N/A is fine for this behavioral fix |
Final message: This PR's title and body meet the repository's PR template and quality expectations. The assigned risk (Medium) matches the changes in the diff; my advised risk level is also risk:medium. The unit tests referenced are present in the diff. You can proceed with merge once CI passes and maintainers approve.
If you want to make any tiny improvements (purely optional):
- Consider optionally adding an inline link to PR fix(designer): Fix infinite recursive nesting in monitoring run history values #9123 where you reference it for easier navigation.
- If the new hook is intended to be shared across other modules, consider noting (in the PR body) whether it will be exported from an index or kept internal in a follow-up.
Thank you for the clear description and tests — nice work unblocking the portal freeze!
Last updated: Fri, 01 May 2026 00:54:01 GMT
preetriti1
approved these changes
May 1, 2026
📊 Coverage Check🎉 All changed files have adequate test coverage! |
takyyon
approved these changes
May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit Type
Risk Level
What & Why
Problem
Follow-up to PR #9123. The inline
placeholderDatafix for infinite recursive nesting worked correctly in the Standalone designer, but caused the portal to freeze completely when opening any action in monitoring view. The browser tab becomes unresponsive and must be force-killed.Root Cause
The fix in #9123 used an inline object literal for
placeholderData:In the portal environment, TanStack Query returns
placeholderDataasdataimmediately (isLoading=false). Because a new object reference is created each render, this triggers an infinite re-render loop:{ inputs: {}, outputs: {} }creates new object referencedata(sinceisLoadingis false withplaceholderData)useEffectfires ondatachange → dispatchesinitializeInputsOutputsBindingThis did not surface in Standalone because the Standalone app initializes the query cache differently (fresh mount vs portal's persistent extension host).
Fix
Extract a dedicated
useRawInputsOutputshook, porting the proven pattern from designer-v2:emptyDataconstant —const emptyData: RawInputsOutputs = { inputs: {}, outputs: {} }at module scope provides a stable reference.placeholderData: emptyDatanever creates a new object, breaking the re-render loop.useRawInputsOutputs.ts) — encapsulates the query logic in a reusable hook with a typedRawInputsOutputsinterface, matching designer-v2's pattern.monitoringTab.tsxnow delegates all data fetching to the hook, reducing its responsibility to layout and dispatch.Why designer-v2 is unaffected
designer-v2's
useRawInputsOutputshook already uses a module-level empty constant. This fix aligns v1 with that pattern.Impact of Change
useRawInputsOutputshook exported fromnodeDetailsPanel/— can be shared across any panel that needs raw action inputs/outputs.Test Plan
Test details:
useRawInputsOutputs.spec.ts— 7 new unit tests covering:should use stable query key with actionTrackingId, startTime, and endTime— verifies cache key stabilityshould use a stable placeholderData reference (prevents infinite re-render)— the core regression test — assertsplaceholderDatais referentially identical across rendersshould always call getActionLinks even when runData has existing inputs/outputs— verifies no shortcutshould not re-feed already-bound BoundParameters as raw inputs (regression)— regression from fix(designer): Fix infinite recursive nesting in monitoring run history values #9123should return empty inputs/outputs when getActionLinks returns nullish values— null safetyshould handle getActionLinks returning null/undefined entirely— edge caseshould pass enabled option when provided— API contractmonitoringTab.spec.tsx— updated to mockuseRawInputsOutputsinstead ofuseQuerydirectly, testing integration points (nodeId passing, loading state, error state)Contributors
@takyyon
Screenshots/Videos
N/A — behavioral fix (unfreezes browser), no visual changes