Skip to content

Conversation

@kl2400033266
Copy link

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:

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:

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

This addresses issue vuejs#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(<key>) can only be used inside setup() or functional components.
- This matches the pattern used in the error message on line 66
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant