Skip to content

Commit 45c875e

Browse files
authored
fix(v3): include key in inject() warning message
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(<key>) can only be used inside setup() or functional components. - This matches the pattern used in the error message on line 66
1 parent 9e88707 commit 45c875e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/v3/apiInject.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,5 @@ export function inject(
6666
warn(`injection "${String(key)}" not found.`)
6767
}
6868
} else if (__DEV__) {
69-
warn(`inject() can only be used inside setup() or functional components.`)
70-
}
69+
warn(`inject(${String(key)}) can only be used inside setup() or functional components.`)
7170
}

0 commit comments

Comments
 (0)