Fix clearTimeout using wrong property name in attribute-behavior fixture#684
Fix clearTimeout using wrong property name in attribute-behavior fixture#684everettbu wants to merge 1 commit into
Conversation
componentWillUnmount was calling clearTimeout(this.interval) but the timeout was stored as this.timeout in onMouseEnter. The timer was never actually cleared on unmount. Fixes #35814
Greptile SummaryThis PR fixes a simple but real bug in
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 9afb274 |
Greptile SummaryThis PR fixes a minor but real bug in the
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Result as Result Component
participant Timer as setTimeout / clearTimeout
User->>Result: onMouseEnter
Result->>Timer: setTimeout(..., 250) → stores as this.timeout
User->>Result: onMouseLeave (or onMouseEnter again)
Result->>Timer: clearTimeout(this.timeout) ✅
Note over Result,Timer: Before fix: componentWillUnmount called clearTimeout(this.interval) ❌
Note over Result,Timer: After fix: componentWillUnmount calls clearTimeout(this.timeout) ✅
User->>Result: Component unmounts
Result->>Timer: clearTimeout(this.timeout) ✅ timer properly cancelled
Last reviewed commit: 9afb274 |
|
Upstream PR was closed or merged. Code is synced via branch mirror. |
Mirror of facebook/react#36000
Original author: ishaquehassan
The componentWillUnmount method in fixtures/attribute-behavior/src/App.js calls clearTimeout(this.interval), but the timeout ID is stored as this.timeout (set in onMouseEnter). Since this.interval is always undefined, the timer never actually gets cleared when the component unmounts.
Fixes #35814
What changed: one-line fix in fixtures/attribute-behavior/src/App.js, changed clearTimeout(this.interval) to clearTimeout(this.timeout).