-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Description
While reviewing the codebase, I noticed that line 253 in packages/pinia/src/store.ts uses loose equality (==) instead of strict equality (===) for a boolean comparison.
Current code:
} else if (isListening == false && !store._hotUpdating) {Proposed fix:
} else if (isListening === false && !store._hotUpdating) {Rationale
- Using
===instead of==is a JavaScript best practice - Prevents potential type coercion issues
- Aligns with modern linting standards (ESLint, Prettier)
- Makes the code more explicit and maintainable
Context
This code is in the onTrigger callback within the createSetupStore function, which handles debugger events during development mode. The isListening variable is declared as boolean type, so strict equality should be used.
Impact
- Risk Level: Very Low
- Breaking Changes: None
- Behavior Change: None (strict equality produces the same result for boolean comparisons)
- Code Quality: Improved
Testing
I have verified that all existing tests pass with this change:
- ✅ 243 tests passed
- ✅ Prettier formatting check passed
I will submit a pull request with this fix.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
✅ Done