vue icon indicating copy to clipboard operation
vue copied to clipboard

fix(v3): include key in inject() warning message

Open kl2400033266 opened this issue 1 month ago • 0 comments

Improves the warning message in the inject() function to include the key being injected.

This addresses issue #13287 where users were unable to identify which inject() call was failing without the key information in the warning message.

Changes made:

  • Modified src/v3/apiInject.ts line 69 to include the injected key in the warning message
  • The warning now displays: inject() can only be used inside setup() or functional components.
  • This matches the pattern used in the error message on line 66

What kind of change does this PR introduce? (check at least one)

  • [ ] Bugfix
  • [ ] Feature
  • [ ] Code style update
  • [ ] Refactor
  • [ ] Build-related changes
  • [ ] Other, please describe:

Does this PR introduce a breaking change? (check one)

  • [ ] Yes
  • [ ] No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • [ ] It's submitted to the main branch for v2.x (or to a previous version branch)
  • [ ] When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
  • [ ] All tests are passing: https://github.com/vuejs/vue/blob/dev/.github/CONTRIBUTING.md#development-setup
  • [ ] New/updated tests are included

If adding a new feature, the PR's description includes:

  • [ ] A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

kl2400033266 avatar Nov 27 '25 06:11 kl2400033266