Skip to content

Optimize provider update pill renders#3770

Draft
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/component-performance-optimization-d2bd
Draft

Optimize provider update pill renders#3770
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/component-performance-optimization-d2bd

Conversation

@cursor

@cursor cursor Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Removed the sidebar provider-update pill's effect-driven timestamp initialization and use a stable mount timestamp instead.
  • Extracted a prop-driven SidebarProviderUpdatePillContent and moved the necessary transition effects into named hooks.
  • Seeded transition state from the initial view so the pill no longer mirrors an already-available view into state after mount.

Why

react-doctor flagged SidebarProviderUpdatePill for state updates in effects and handler-only state. The old mount path performed an extra commit for every fresh pill mount. The new implementation avoids the unnecessary initial effect commit while keeping transition/dismiss behavior isolated in a named hook.

UI Changes

No visual UI change intended.

React Scan recordings captured with the temporary harness:

  • Before: react_scan_provider_update_pill_before.mp4 — 5 remounts reached 10 pill commits.
  • After: react_scan_provider_update_pill_after.mp4 — the same 5 remounts reached 5 pill commits.

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:

  • vp check passed (0 errors, existing warnings remain)
  • vp run typecheck passed
  • react-doctor --category performance rerun; broader repo findings remain, but the provider pill timestamp/state-only finding is removed. The remaining provider-pill transition update is in a named hook and is required for exit animations.
Open in Web View Automation 

Note

Refactor SidebarProviderUpdatePill to set visibility threshold at mount time

  • Splits SidebarProviderUpdatePill into a thin wrapper and a new SidebarProviderUpdatePillContent component, extracting transition/dismiss logic into useSidebarProviderUpdatePillTransition.
  • Replaces the latestProviderCheckedAt util with a new useProviderUpdateSidebarVisibleAfterIso hook that sets visibleAfterIso to the component mount time instead of deriving it from provider checkedAt values.
  • Behavioral Change: the pill's visibility/dismiss threshold is now always the mount time, so providers checked before the component mounts will not affect which updates are shown.
📊 Macroscope summarized 259ff41. 1 file reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted

🗂️ Filtered Issues

No issues evaluated.

cursoragent and others added 3 commits July 7, 2026 16:08
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
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:L 100-499 changed lines (additions + deletions). labels Jul 7, 2026
onOpenProviderSettings: () => void;
}

function useProviderUpdateSidebarVisibleAfterIso(): string {

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.

🟡 Medium sidebar/SidebarProviderUpdatePill.tsx:42

useProviderUpdateSidebarVisibleAfterIso captures new Date().toISOString() at mount, so any provider update that finished before the remount is permanently filtered out — the pill disappears on remount even though the update is still relevant. When the sidebar unmounts and remounts (e.g. on layout/mobile state changes), visibleAfterIso jumps forward to the new mount time, and getProviderUpdateSidebarPillView drops any update whose finishedAt predates it. The previous approach derived the threshold from provider data (latestProviderCheckedAt), so the notice survived remounts until provider state actually changed. Consider deriving visibleAfterIso from provider state rather than component mount time, or document why remounts should hide previously-eligible updates.

🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @apps/web/src/components/sidebar/SidebarProviderUpdatePill.tsx around line 42:

`useProviderUpdateSidebarVisibleAfterIso` captures `new Date().toISOString()` at mount, so any provider update that finished before the remount is permanently filtered out — the pill disappears on remount even though the update is still relevant. When the sidebar unmounts and remounts (e.g. on layout/mobile state changes), `visibleAfterIso` jumps forward to the new mount time, and `getProviderUpdateSidebarPillView` drops any update whose `finishedAt` predates it. The previous approach derived the threshold from provider data (`latestProviderCheckedAt`), so the notice survived remounts until provider state actually changed. Consider deriving `visibleAfterIso` from provider state rather than component mount time, or document why remounts should hide previously-eligible updates.

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

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant