Skip to content

Conversation

@Davont
Copy link
Member

@Davont Davont commented Dec 3, 2025

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features

    • Code viewer adds a "chart" display mode and refines syntax highlighting: Vue files retain HTML highlighting; "chart" mode displays raw chart code; dependent code blocks consistently use TypeScript highlighting.
  • Chores

    • Removed BaiduMap and Autonavi map chart options from the demo menu, streamlining available chart selections.

✏️ Tip: You can customize this high-level summary in your review settings.

Davont and others added 30 commits May 20, 2024 04:08
@github-actions github-actions bot added the bug Something isn't working label Dec 3, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 3, 2025

Walkthrough

Commented out two map chart entries in the PC demo menu; changed AsyncHighlight usage in api-docs.vue from :types to :type with new value mapping; added a type prop to async-highlight.vue and adjusted highlighting behavior (raw output for type === 'chart').

Changes

Cohort / File(s) Summary
Menu configuration
examples/sites/demos/pc/menus.js
Commented out two chart entries in cmpMenus Chart list: BaiduMap Chart (百度地图) and Autonavi Chart (高德地图).
API docs usage
examples/sites/src/components/api-docs.vue
Replaced :types="props.chartCode ? 'html' : 'ts'" with :type="props.chartCode ? 'chart' : ''" and updated nested usage from types="ts" to type="ts".
Highlight component
examples/sites/src/components/async-highlight.vue
Added public prop type: { type: String, default: '' }; when filename ends with .vue use HTML highlighting, when type === 'chart' return raw code, otherwise use automatic highlighting.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review async-highlight.vue branches: .vue filename handling, type === 'chart' raw-return path, and fallback highlighting.
  • Verify api-docs.vue bindings and that type empty-string behaves as expected for non-chart files.
  • Confirm the commented menu entries are intentional and don't require runtime feature toggles.

Poem

🐰 I hopped through lines with gentle cheer,
Tucked two maps out of sight, kept the rest near,
A tiny prop I planted true,
Bright highlights now know what to do,
I bound my whiskers to this new frontier.

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 title accurately describes the main changes: hiding Baidu Maps and Amap from documentation and repairing chart document functionality through prop updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 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 2bd21d4 and 4aa577d.

📒 Files selected for processing (1)
  • examples/sites/src/components/async-highlight.vue (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • examples/sites/src/components/async-highlight.vue

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
examples/sites/demos/pc/menus.js (1)

350-351: Hiding Baidu/Autonavi chart menu items is fine; consider adding a brief rationale comment

Commenting out these two entries cleanly removes the Baidu/Autonavi map charts from the Chart menu without affecting surrounding items or structure, so the behavior change is safe.

To help future maintainers understand why these routes are hidden (and that native maps are preferred now), consider adding a short note similar to other hidden items in this file, for example:

-      // { 'nameCn': '百度地图', 'name': 'BaiduMap Chart', 'key': 'chart-baidu-map' },
-      // { 'nameCn': '高德地图', 'name': 'Autonavi Chart', 'key': 'chart-autonavi-map' },
+      // { 'nameCn': '百度地图', 'name': 'BaiduMap Chart', 'key': 'chart-baidu-map' }, // 已下线,推荐使用原生地图能力
+      // { 'nameCn': '高德地图', 'name': 'Autonavi Chart', 'key': 'chart-autonavi-map' }, // 已下线,推荐使用原生地图能力

This keeps the intent aligned with the PR description and avoids confusion later.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4047778 and 68cac15.

📒 Files selected for processing (1)
  • examples/sites/demos/pc/menus.js (1 hunks)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
examples/sites/src/components/api-docs.vue (1)

39-39: Critical: Inconsistent prop name will break highlighting.

Line 39 still uses the old prop name types="ts", but the AsyncHighlight component now expects type. This inconsistency will cause the prop to be ignored, resulting in incorrect or missing syntax highlighting for dependent types.

Apply this diff to fix the prop name:

                       <async-highlight
                         v-for="(k, i) in row.depTypes"
                         :key="i"
                         :code="props.currentJson.types[k]?.code"
-                        types="ts"
+                        type="ts"
                       ></async-highlight>
🧹 Nitpick comments (1)
examples/sites/src/components/async-highlight.vue (1)

23-25: Consider adding a default value for consistency.

The new type prop lacks a default value. While this follows the pattern of the filename prop, adding default: '' would make the behavior more explicit and prevent potential issues if the prop is undefined.

Apply this diff to add a default value:

 type: {
-  type: String
+  type: String,
+  default: ''
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 68cac15 and 746b9f1.

📒 Files selected for processing (2)
  • examples/sites/src/components/api-docs.vue (1 hunks)
  • examples/sites/src/components/async-highlight.vue (2 hunks)
🔇 Additional comments (2)
examples/sites/src/components/async-highlight.vue (1)

38-39: LGTM! Chart code bypass is correctly implemented.

The new conditional branch properly handles chart code by skipping syntax highlighting when type === 'chart'. This aligns with the PR's objective to handle chart content differently.

examples/sites/src/components/api-docs.vue (1)

32-32: LGTM! Prop update correctly aligns with AsyncHighlight changes.

The change from :types to :type with updated value mapping ('chart' vs empty string) correctly aligns with the new prop and logic in the AsyncHighlight component.

@Davont Davont changed the title fix: Hide Baidu Maps and Amap from the document and recommend users to use native maps in the future fix: Hide Baidu Maps and Amap from the document and Repair the chart document Dec 8, 2025
@Davont Davont changed the title fix: Hide Baidu Maps and Amap from the document and Repair the chart document fix(chart): Hide Baidu Maps and Amap from the document and Repair the chart document Dec 8, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 746b9f1 and 2bd21d4.

📒 Files selected for processing (1)
  • examples/sites/src/components/api-docs.vue (1 hunks)
🔇 Additional comments (1)
examples/sites/src/components/api-docs.vue (1)

35-40: LGTM! Consistent prop rename.

The change from types="ts" to type="ts" is consistent with the AsyncHighlight API update and maintains the TypeScript highlighting for dependency types.

Comment on lines 29 to 33
<async-highlight
v-if="row.code"
:code="row.code.trim()"
:types="props.chartCode ? 'html' : 'ts'"
:type="props.chartCode ? 'chart' : ''"
></async-highlight>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

cat examples/sites/src/components/async-highlight.vue

Repository: opentiny/tiny-vue

Length of output: 2689


🏁 Script executed:

git log --oneline -20 examples/sites/src/components/async-highlight.vue

Repository: opentiny/tiny-vue

Length of output: 151


🏁 Script executed:

fd async-highlight examples/sites/src/

Repository: opentiny/tiny-vue

Length of output: 110


🏁 Script executed:

git log --oneline -10 examples/sites/src/components/api-docs.vue

Repository: opentiny/tiny-vue

Length of output: 151


🏁 Script executed:

git show --stat HEAD

Repository: opentiny/tiny-vue

Length of output: 50374


The type prop passed to AsyncHighlight does not exist in the component definition.

AsyncHighlight only accepts code and filename props. The :type="props.chartCode ? 'chart' : ''" binding on lines 32 and similar usage elsewhere will be silently ignored. The component uses the filename prop to determine syntax highlighting language (checks if it ends with .vue for HTML highlighting, otherwise uses auto-detect). Either update AsyncHighlight to accept and use a type prop, or remove the type binding from api-docs.vue and rely on the filename prop instead.

🤖 Prompt for AI Agents
In examples/sites/src/components/api-docs.vue around lines 29–33, the
AsyncHighlight component is being passed a non-existent type prop
(:type="props.chartCode ? 'chart' : ''"); AsyncHighlight only accepts code and
filename so this binding is ignored. Fix by removing the :type binding from the
AsyncHighlight usage and, if you need chart-specific highlighting, populate or
derive the filename prop (e.g., set filename to a .vue/.js/.chart-like value or
compute filename when props.chartCode is true) so the component can select the
correct language via its existing filename logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant