improvement(performance): used react scan to identify rerendering issues and react issues#2873
Merged
waleedlatif1 merged 1 commit intostagingfrom Jan 18, 2026
Merged
improvement(performance): used react scan to identify rerendering issues and react issues#2873waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1 merged 1 commit intostagingfrom
Conversation
…ues and react issues
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThis PR implements comprehensive performance optimizations identified using React Scan, focusing on reducing unnecessary re-renders across the application through strategic use of Zustand selectors, memoization, and component architecture improvements. Key Optimizations:
Impact: Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Component
participant Hook
participant ZustandStore
participant ReactScan
Note over ReactScan: Dev-only performance monitoring
User->>ReactScan: Enable REACT_SCAN_ENABLED flag
ReactScan-->>User: Loads react-scan script
Note over Component,ZustandStore: Before: Whole-store subscriptions
Component->>Hook: useUndoRedo()
Hook->>ZustandStore: Subscribe to entire store
ZustandStore-->>Hook: Full store state
ZustandStore->>Component: Re-render on ANY store change
Note over Component,ZustandStore: After: Selective subscriptions
Component->>Hook: useUndoRedo()
Hook->>ZustandStore: getState().push() (no subscription)
ZustandStore-->>Hook: Execute action only
Note over Component: No re-render triggered
Note over Component,ZustandStore: Before: useMemo with dependencies
Component->>Hook: useEditorBlockProperties()
Hook->>ZustandStore: Subscribe to blocks, baselineBlocks
ZustandStore->>Hook: Full blocks object
Hook->>Hook: useMemo recalculates
Hook-->>Component: Block properties
Note over Component,ZustandStore: After: Selective with shallow
Component->>Hook: useEditorBlockProperties()
Hook->>ZustandStore: Select specific block props + shallow
ZustandStore-->>Hook: Only {advancedMode, triggerMode}
Hook-->>Component: Block properties (no re-render if equal)
Note over Component,ZustandStore: Operation Queue optimization
Component->>Hook: useOperationQueue()
Hook->>ZustandStore: getState() for actions
Hook->>ZustandStore: Subscribe only to hasOperationError
ZustandStore->>Hook: queue/isProcessing via getters
Note over Component: Re-renders only on error state changes
Note over Component: Component memoization
User->>Component: Props change
Component->>Component: React.memo equality check
alt Props unchanged
Component-->>User: Skip re-render
else Props changed
Component->>Component: Re-render
Component-->>User: Updated UI
end
|
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.
Summary
Type of Change
Testing
Tested manually
Checklist