router icon indicating copy to clipboard operation
router copied to clipboard

chore: make `warnDeprecatedUsage` warn info more explicit

Open btea opened this issue 1 month ago β€’ 2 comments

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.

btea avatar Oct 23 '25 02:10 btea

Deploy Preview for vue-router canceled.

Name Link
Latest commit 3938a7d0c83dc6f9765e42d0c4ccfa63bb4cbd6a
Latest deploy log https://app.netlify.com/projects/vue-router/deploys/68f99798c51e180009034da1

netlify[bot] avatar Oct 23 '25 02:10 netlify[bot]

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.

coderabbitai[bot] avatar Oct 23 '25 02:10 coderabbitai[bot]