Skip to content

Conversation

@maniktyagi04
Copy link
Contributor

@maniktyagi04 maniktyagi04 commented Dec 3, 2025

Description

This PR fixes a code quality issue where loose equality (==) is used instead of strict equality (===) for a boolean comparison in store.ts.

Changes

  • Changed line 253 in packages/pinia/src/store.ts from isListening == false to isListening === false

Motivation

Using strict equality (===) instead of loose equality (==) is a JavaScript best practice that:

  • Prevents potential type coercion issues
  • Makes the code more explicit and maintainable
  • Aligns with modern linting standards

Context

The change is in the onTrigger callback within the createSetupStore function, which handles debugger events during development mode. The isListening variable is declared as boolean type.

Testing

✅ All existing tests pass:

  • 243 tests passed
  • Prettier formatting check passed
  • No breaking changes

Impact

  • Risk Level: Very Low
  • Breaking Changes: None
  • Behavior: No functional change (strict equality produces the same result for boolean comparisons)
  • Code Quality: Improved

Fixes #3078

Summary by CodeRabbit

  • Chores
    • Enhanced precision of internal debugger event handling logic to improve code reliability.

✏️ Tip: You can customize this high-level summary in your review settings.

Replace loose equality (==) with strict equality (===) for isListening
boolean comparison on line 253. This follows JavaScript best practices
and prevents potential type coercion issues.

The change is in the onTrigger callback within createSetupStore function,
which handles debugger events during development mode.
@netlify
Copy link

netlify bot commented Dec 3, 2025

Deploy Preview for pinia-official canceled.

Name Link
🔨 Latest commit 924f8d1
🔍 Latest deploy log https://app.netlify.com/projects/pinia-official/deploys/69308bdcfb9ad70008ff6436

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 3, 2025

Walkthrough

A single operator change improving code quality: loose equality (==) was replaced with strict equality (===) for a boolean comparison in the debugger event handler within the store creation function. No functional behavior changes.

Changes

Cohort / File(s) Summary
Code Quality
packages/pinia/src/store.ts
Changed loose equality to strict equality for boolean comparison in debugger event handler (isListening == falseisListening === false)

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

  • Single-line operator change with no functional impact or control flow modifications

Poem

🐰 A hop, a skip, best practices bloom,
When == fades to === in the room!
No loose comparisons lurk about,
Our booleans dance in strict, crisp route! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The PR title 'refactor: use strict equal' is vague and incomplete, failing to clearly convey the specific change (strict equality for boolean comparison). Consider revising the title to be more specific and descriptive, such as 'refactor: use strict equality for boolean comparison' to better reflect the actual change.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The pull request fully addresses the requirements from issue #3078: replacing loose equality (==) with strict equality (===) for the boolean comparison in store.ts line 253.
Out of Scope Changes check ✅ Passed The pull request contains only the single, targeted change specified in the linked issue with no additional out-of-scope modifications.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 3, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@pinia/nuxt@3079
npm i https://pkg.pr.new/pinia@3079
npm i https://pkg.pr.new/@pinia/testing@3079

commit: 924f8d1

Copy link
Member

@posva posva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.90%. Comparing base (9182fdb) to head (924f8d1).
⚠️ Report is 2 commits behind head on v3.

Additional details and impacted files
@@           Coverage Diff           @@
##               v3    #3079   +/-   ##
=======================================
  Coverage   90.90%   90.90%           
=======================================
  Files          19       19           
  Lines        1683     1683           
  Branches      237      237           
=======================================
  Hits         1530     1530           
  Misses        151      151           
  Partials        2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@posva posva changed the title fix: use strict equality for boolean comparison in store.ts refactor: use strict equal Dec 3, 2025
@posva posva merged commit 84159b3 into vuejs:v3 Dec 3, 2025
9 checks passed
@github-project-automation github-project-automation bot moved this from 🆕 Triaging to ✅ Done in Pinia Roadmap Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

Code Quality: Use strict equality for boolean comparison in store.ts

2 participants