chore: make `warnDeprecatedUsage` warn info more explicit
There is relevant judgment logic inside the function, and we can make the warning information clearer.
Summary by CodeRabbit
- Refactor
- Improved the deprecation warning mechanism to provide more accurate component context information.
Deploy Preview for vue-router canceled.
| Name | Link |
|---|---|
| Latest commit | 3938a7d0c83dc6f9765e42d0c4ccfa63bb4cbd6a |
| Latest deploy log | https://app.netlify.com/projects/vue-router/deploys/68f99798c51e180009034da1 |
Walkthrough
The warning message in warnDeprecatedUsage function is refactored to dynamically interpolate the parent component tag using a computed variable instead of hard-coding references to <transition> and <keep-alive>. Message content remains unchanged.
Changes
| Cohort / File(s) | Summary |
|---|---|
Dynamic warning message packages/router/src/RouterView.ts |
Updated deprecated usage warning to interpolate parent component tag via computed variable rather than hard-coded component references |
Estimated code review effort
π― 1 (Trivial) | β±οΈ ~3 minutes
Poem
π° A warning message, once rigid and plain, Now dances with variables, breaking its chain, The comp takes the stage with computational grace, Making deprecations more fitting in place!
Pre-merge checks and finishing touches
β Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | β Passed | Check skipped - CodeRabbitβs high-level summary is enabled. |
| Title Check | β Passed | The pull request title "chore: make warnDeprecatedUsage warn info more explicit" directly aligns with the primary change in the changeset. The modification updates the warning message in warnDeprecatedUsage to interpolate the parent component tag dynamically via a computed comp variable rather than using hard-coded references to <transition> and <keep-alive>. This change makes the warning information clearer and more explicit, which is precisely what the title communicates. The title is concise, specific enough to convey the main objective to a reviewer scanning the history, and avoids vague or misleading language. |
| Docstring Coverage | β Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
β¨ Finishing touches
- [ ] π Generate docstrings
π§ͺ Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
π Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
π₯ Commits
Reviewing files that changed from the base of the PR and between f420992ec453a09b22449617be9e30307d52acdf and 3938a7d0c83dc6f9765e42d0c4ccfa63bb4cbd6a.
π Files selected for processing (1)
packages/router/src/RouterView.ts(1 hunks)
π Additional comments (1)
packages/router/src/RouterView.ts (1)
252-260: LGTM! Warning message is now more specific and helpful.The dynamic interpolation of the parent component tag makes the deprecation warning clearer by showing users exactly which wrapper component is causing the issue, rather than listing both possibilities. The example code will now accurately reflect their specific situation.
Comment @coderabbitai help to get the list of available commands and usage tips.