Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Remove provider environment sync effect#3061

Draft
cursor[bot] wants to merge 1 commit into
main from
cursor/component-performance-optimization-4a06
Draft

Remove provider environment sync effect #3061
cursor[bot] wants to merge 1 commit into
main from
cursor/component-performance-optimization-4a06

Conversation

@cursor

@cursor cursor Bot commented Jun 12, 2026
edited by macroscopeapp Bot
Loading

Copy link
Copy Markdown
Contributor

What Changed

  • Removed the direct useEffect that mirrored provider environment props into local draft row state in ProviderEnvironmentSection.
  • Key the small environment editor from the upstream environment values so external changes still reset the draft editor without a cascading effect render.

Why

React Doctor flagged ProviderInstanceCard.tsx for synchronous state updates inside an effect. This environment editor already owns draft rows locally during edits and publishes committed rows upward, so the mirror effect added an extra render pass after normal commits. Remounting the editor only when upstream environment values change preserves reset behavior while avoiding the unnecessary effect.

UI Changes

Before/after react-scan recordings were captured with react-scan enabled:

  • Before: react_scan_provider_env_before.mp4
  • After: react_scan_provider_env_after.mp4

React Doctor verification: the post-fix performance scan no longer reports src/components/settings/ProviderInstanceCard.tsx:165 under the synchronous setState-in-effect diagnostic.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Validation:

  • react-doctor --verbose --category performance (targeted finding removed; other existing repo findings remain)
  • vp check (passed with existing warnings)
  • vp run typecheck (passed)

Note

Replace useEffect sync with key-based remounting in ProviderEnvironmentSection

  • Removes the useEffect that kept ProviderEnvironmentSection's internal rows state in sync with props.environment after mount.
  • Adds a getProviderEnvironmentSectionKey helper in ProviderInstanceCard.tsx that JSON-stringifies each variable's name, value, sensitive, and valueRedacted fields to produce a stable key.
  • ProviderInstanceCard passes this key to ProviderEnvironmentSection, causing the subtree to remount (and re-initialize state from props) whenever environment content changes.
  • Behavioral Change: ProviderEnvironmentSection no longer updates its rows in-place when props change — it resets entirely via remount instead.

Macroscope summarized f65e38f.

Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Jun 12, 2026

Copy link
Copy Markdown
Contributor

🚀 Expo continuous deployment is ready!

  • Project → t3-code
  • Platforms → android, ios
  • Scheme → t3code-preview
🤖 Android 🍎 iOS
Fingerprint ae17d94b35f91f9c608a63dadbc3ddd9f4ba056e 313e506a7f15a9c3f15b01d787d68a12382432bf
Build Details Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: ae17d94b35f91f9c608a63dadbc3ddd9f4ba056e
App version: 0.1.0
Git commit: 534897ad2adf39e951b2afc450d1df9f3faab400
Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: 313e506a7f15a9c3f15b01d787d68a12382432bf
App version: 0.1.0
Git commit: 534897ad2adf39e951b2afc450d1df9f3faab400
Update Details Update Permalink
DetailsBranch: pr-3061
Runtime version: ae17d94b35f91f9c608a63dadbc3ddd9f4ba056e
Git commit: 534897ad2adf39e951b2afc450d1df9f3faab400
Update Permalink
DetailsBranch: pr-3061
Runtime version: 313e506a7f15a9c3f15b01d787d68a12382432bf
Git commit: 534897ad2adf39e951b2afc450d1df9f3faab400
Update QR

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

Reviewers

No reviews

Assignees

No one assigned

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /