Skip to content

perf(designer): reduce panel rerenders#9409

Open
ccastrotrejo wants to merge 2 commits into
Azure:mainfrom
ccastrotrejo:ccastrotrejo-microsoft-perf-optimize-hot-paths
Open

perf(designer): reduce panel rerenders#9409
ccastrotrejo wants to merge 2 commits into
Azure:mainfrom
ccastrotrejo:ccastrotrejo-microsoft-perf-optimize-hot-paths

Conversation

@ccastrotrejo

Copy link
Copy Markdown
Contributor

Commit Type

  • feature - New functionality
  • fix - Bug fix
  • refactor - Code restructuring without behavior change
  • perf - Performance improvement
  • docs - Documentation update
  • test - Test-related changes
  • chore - Maintenance/tooling

Risk Level

  • Low - Minor changes, limited scope
  • Medium - Moderate changes, some user impact
  • High - Major changes, significant user/system impact

What & Why

Panel selector hooks created memoized selectors during render and returned fresh empty arrays or objects for missing optional state. Unrelated panel actions therefore changed selector result identity and re-rendered consumers. This change uses direct selectors with stable fallbacks in both designer implementations and also overlaps two independent connection service requests instead of awaiting them serially.

Impact of Change

  • Users: Designer panels avoid unnecessary updates, and managed-identity connection changes no longer serialize independent network latency.
  • Developers: Panel hooks now follow the repository's direct-selector convention; regression tests document referential-stability requirements.
  • System: Unrelated panel dispatches produce zero extra renders for fallback consumers. Independent connector and connection reads complete in roughly the slower request's duration instead of their combined duration.

Test Plan

  • Unit tests added/updated
  • E2E tests added/updated
  • Manual testing completed
  • Tested in: Targeted Vitest selector and connection suites; designer and designer-v2 type checks; designer-v2 library build

Contributors

@ccastrotrejo_microsoft

Screenshots/Videos

N/A - no visual changes.

Stabilize panel selector fallbacks and remove per-render selector construction. Fetch independent connection resources concurrently and add regression coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 78b1618e-11be-48d0-984e-6709297a646e
Undo unrelated localization extraction changes introduced by the commit hook.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 78b1618e-11be-48d0-984e-6709297a646e
Copilot AI review requested due to automatic review settings July 16, 2026 18:21
@ccastrotrejo ccastrotrejo added the risk:medium Medium risk change with potential impact label Jul 16, 2026
@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

🤖 AI PR Validation Report

PR Review Results

Thank you for your submission! Here's detailed feedback on your PR title and body compliance:

PR Title

  • Current: perf(designer): reduce panel rerenders
  • Issue: None — uses the valid perf(scope): prefix and is descriptive of the actual change.
  • Recommendation: No change needed.

Commit Type

  • Exactly one type selected (perf - Performance improvement).
  • Matches the diff: selector refactors to eliminate spurious re-renders and a serial→concurrent connection fetch. Good fit.

Risk Level

  • Exactly one box selected (Medium) and the risk:medium label matches the body. My advised estimate is medium as well: these are state-management/selector changes in shipped libs/designer and libs/designer-v2 runtime code plus a connection-flow concurrency change — moderate user impact, no security/API/shared-utility breakage. Declared level matches advised level. ✅

What & Why

  • Current: Clear explanation of the per-render createSelector fallback problem and the concurrent connection-read optimization.
  • Issue: None.
  • Recommendation: No change needed.

Impact of Change

  • All three audiences (Users, Developers, System) are filled with specific, accurate detail.
  • Recommendation:
    • Users: Already documented (fewer unnecessary panel updates; faster managed-identity connection changes).
    • Developers: Already documented (direct-selector convention; referential-stability regression tests).
    • System: Already documented (zero extra renders on unrelated dispatches; overlapped network reads).

Test Plan

  • Unit tests added/updated in both libs/designer-v2/.../panelSelectors.perf.spec.tsx and libs/designer/.../panelSelectors.perf.spec.tsx, capturing before/after referential stability. Test requirement satisfied.

Contributors

  • Credited @ccastrotrejo_microsoft. Good.

⚠️ Screenshots/Videos

  • Marked N/A - no visual changes. Correct — the diff touches state selectors and connection logic, not visual UI, so screenshots are not required.

Summary Table

Section Status Recommendation
Title No change needed
Commit Type No change needed
Risk Level Medium is correct and matches label
What & Why No change needed
Impact of Change No change needed
Test Plan Unit tests present
Contributors Credited
Screenshots/Videos ⚠️ N/A acceptable — non-visual change

All required checks pass. This PR is compliant with the team template and cleared to merge.


Powered by: Copilot CLI (claude-opus-4.8) | Last updated: Thu, 16 Jul 2026 18:23:24 GMT

Copilot AI 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.

Pull request overview

This PR improves performance in the Logic Apps Designer (both designer and designer-v2) by making panel selector hooks return referentially-stable values for optional state and by avoiding sequential (waterfall) network reads during managed-identity connection updates.

Changes:

  • Replaced per-render createSelector usage in panel selector hooks with direct selectors, eliminating unnecessary selector recreation and avoiding identity churn.
  • Introduced stable module-level empty fallbacks ({} / []) for optional panel selection state to prevent spurious rerenders on unrelated dispatches.
  • Parallelized independent connector + connection reads via Promise.all to reduce latency when updating managed-identity connection configuration.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
libs/designer/src/lib/core/state/panel/panelSelectors.ts Switches panel hooks to direct selectors and adds a stable {} fallback for alternateSelectedNode to prevent unnecessary rerenders.
libs/designer/src/lib/core/state/panel/test/panelSelectors.perf.spec.tsx Adds a regression perf test verifying referential stability for the v1 selector fallback behavior.
libs/designer-v2/src/lib/core/state/panel/panelSelectors.ts Applies the same selector changes for v2, adding stable {} and [] fallbacks used by operation panel selection hooks.
libs/designer-v2/src/lib/core/state/test/panelSelectors.perf.spec.tsx Adds regression perf tests covering both stable [] and {} selector fallback behavior in v2.
libs/designer-v2/src/lib/core/actions/bjsworkflow/connections.ts Fetches connector + connection concurrently during identity update to avoid serialized network latency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-validated risk:medium Medium risk change with potential impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants