Skip to content

docs: add missing comma between mapState spreads in the Options API example#3130

Merged
posva merged 1 commit into
vuejs:v4from
DucMinhNe:fix/mapstate-example-missing-comma
Jun 6, 2026
Merged

docs: add missing comma between mapState spreads in the Options API example#3130
posva merged 1 commit into
vuejs:v4from
DucMinhNe:fix/mapstate-example-missing-comma

Conversation

@DucMinhNe

@DucMinhNe DucMinhNe commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Summary

The Options API mapState() example in core-concepts/state.md is missing a comma between its two object-spread computed entries:

computed: {
  ...mapState(useCounterStore, ['count'])
  // same as above but registers it as this.myOwnName
  ...mapState(useCounterStore, {
    ...
  }),
},

Two spread elements in an object literal with no comma between them is a hard SyntaxError. Verified with node --check: the snippet throws SyntaxError: Unexpected token '...' at the second ...mapState(...), so anyone copying this example verbatim cannot run it.

Change

Add the missing trailing comma after ...mapState(useCounterStore, ['count']). After the fix, node --check parses the example cleanly. One-character, docs-only change; no semantics altered.

The same fix was already applied to the Chinese translation of this file in #3102 — this brings the English source in line.

Summary by CodeRabbit

  • Documentation
    • Updated code examples in core concepts documentation to improve formatting consistency.

@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

PR changed again? Review this PR in Change Stack to compare snapshots and stay oriented.

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a7b354ac-34a1-4fb5-8320-d97f47ed1bae

📥 Commits

Reviewing files that changed from the base of the PR and between 697cd81 and c8f80ad.

📒 Files selected for processing (1)
  • packages/docs/core-concepts/state.md

📝 Walkthrough

Walkthrough

This PR updates a single code example in the Pinia state documentation. Line 166 of packages/docs/core-concepts/state.md adds a trailing comma to the ...mapState(useCounterStore, ['count']) spread line within the Options API computed example.

Changes

State Documentation

Layer / File(s) Summary
Options API computed example formatting
packages/docs/core-concepts/state.md
The mapState spread line in the computed code example is updated to include a trailing comma for improved code style consistency.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • vuejs/pinia#3102: Updates the same mapState(useCounterStore, ['count']) example with trailing comma formatting alongside other documentation edits.

Suggested reviewers

  • posva

Poem

🐰 A comma hops in, small but true,
Code style shines in comma's view,
One line changed, consistency won,
Documentation's work, neat and done! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a missing comma between mapState spreads in the Options API example in the documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@posva posva left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@posva posva merged commit 1ff1065 into vuejs:v4 Jun 6, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from 🆕 Triaging to ✅ Done in Pinia Roadmap Jun 6, 2026
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.

2 participants