Skip to content

Conversation

@vaebe
Copy link
Contributor

@vaebe vaebe commented Jan 20, 2026

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?

替换 eslint 统一格式化的时候出现了一些问题

  1. 把 icon 导入的代码错误移除了,现在已经还原,图标导入先执行函数 然后在模版中使用
  2. 函数调用时传递多余 函数要求的参数

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

    • Toggle for theme visibility and improved dark-mode handling (applies body filter on dark mode).
  • Refactor

    • Standardized icon initialization across components.
    • Streamlined Vue composition imports and simplified form-step call signatures.
    • Menu data load/sync improved to better reflect active tab.
  • Style

    • Various formatting and CSS scope adjustments (no intentional visual changes).

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

@github-actions github-actions bot added the enhancement New feature or request label Jan 20, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 20, 2026

Walkthrough

Replaced several direct icon component imports with lowercase factory imports and runtime instantiation; removed some compile-time composition API named imports; simplified packaged() calls; adjusted theme-related types and useTheme signature and added themeVisible(); plus numerous formatting and minor CSS scope changes across templates.

Changes

Cohort / File(s) Summary
Icon factory migration
template/tinyvue/src/components/global-setting/index.vue, template/tinyvue/src/components/navbar/index.vue, template/tinyvue/src/components/theme/index.vue, template/tinyvue/src/views/login/components/login-lang.vue, template/tinyvue/src/views/menu/info/components/menu-tree.vue, template/tinyvue/src/views/permission/info/components/info-tab.vue, template/tinyvue/src/views/role/info/components/role-table.vue, template/tinyvue/src/views/user/info/components/info-tab.vue
Replaced direct component imports (e.g., IconClose, IconEdit, IconDel, IconChevronDown, IconYes, IconLanguage, IconCueL, IconCheckOut, IconUser) with lowercase factory function imports (e.g., iconClose, iconEdit, iconDel, iconChevronDown, iconYes, iconLanguage, iconCueL, iconCheckOut, iconUser) and added local instantiation (const IconX = iconX()). Template usage preserved.
Vue composition import adjustments
template/tinyvue/src/views/form/base/components/base-info.vue, template/tinyvue/src/views/form/step/components/coach-form.vue, template/tinyvue/src/views/form/step/components/director-form.vue, template/tinyvue/src/views/profile/detail/components/record-detail.vue
Removed explicit imports of compile-time composition helpers (defineProps, defineExpose) from named vue imports; kept runtime helpers (computed, ref, reactive, toRefs). Note: record-detail.vue still uses defineProps but no longer imports it.
Theme API and behavior changes
template/tinyvue/src/hooks/useTheme.ts, template/tinyvue/src/components/theme/type.ts, template/tinyvue/src/components/theme/index.vue, template/tinyvue/src/layout/default-layout.vue
useTheme signature changed to accept TinyThemeTool (not typeof TinyThemeTool); added dark-mode body-filter watch and adjusted theme application logic. Removed explicit any annotations from SwitchlightColor/SwitchdarkColor. Added new themeVisible() function in default-layout.vue and minor theme typing/usage updates.
packaged() call simplification
template/tinyvue/src/views/form/step/components/collapse-form.vue
Simplified packaged() calls by removing the third parameter for steps (now (vaild, index) only).
Menu data ordering & mounted watch
template/tinyvue/src/components/menu/index.vue
Deferred initial menu fetch and moved rawMenuData initialization after filter function; added mounted watch to sync tabStore.current to tree current key and auto-expand parent on change.
Grid/Column inline refactor
template/tinyvue/src/views/board/home/components/regiontable.vue, template/tinyvue/src/views/board/home/components/roundtable.vue, template/tinyvue/src/views/board/home/components/region.vue, template/tinyvue/src/views/board/home/components/curve.vue, template/tinyvue/src/views/board/home/components/falls.vue, template/tinyvue/src/views/board/home/components/round.vue
Reflowed TinyGrid/TinyGridColumn and chart components to inline/multi-line prop formatting or consolidated column definitions; no data/logic changes.
Minor behavioral/logic formatting
template/tinyvue/src/views/board/work/components/learn-coach.vue, template/tinyvue/src/views/board/work/components/learn-plan.vue, template/tinyvue/src/views/board/work/components/learn-practiced.vue, template/tinyvue/src/views/board/work/components/learn-probation.vue, template/tinyvue/src/views/board/work/components/learn-traini.vue, template/tinyvue/src/views/board/work/index.vue
Small code style changes (if-statement blocks, spacing, CSS formatting) and a few added CSS rules; no logic behavior changes except formatting.
Breadcrumb prop default refactor
template/tinyvue/src/components/breadcrumb/index.vue
Replaced explicit defineProps default object with destructured const { items = [] } = defineProps<{ items?: string[] }>(), preserving type but changing default provisioning.
Whitespace / CSS scope & tiny formatting changes
multiple files (transitions, footer, exceptions, other components) — see summary
Various whitespace, selector indentation, style scope changes (notably moving a @media rule to global scope in main.vue), and removal of inline comments; no functional changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 I hopped through icons, from caps to small,

I nudged some props and let defaults fall.
I brushed the CSS, watched themes take flight,
A tiny patch, then off for a bite. 🥕

🚥 Pre-merge checks | ✅ 3
✅ 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 objective: fixing bugs caused by switching to @antfu/eslint-config. It directly relates to the widespread import changes throughout the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@vaebe vaebe changed the title feat(tinyvue): icon 导入 fix(tinyvue): icon 导入,先执行函数然后在模版中使用 Jan 20, 2026
@github-actions github-actions bot added bug Something isn't working and removed enhancement New feature or request labels Jan 20, 2026
@vaebe vaebe changed the title fix(tinyvue): icon 导入,先执行函数然后在模版中使用 fix(tinyvue): 修复因替换到 @antfu/eslint-config 导致的 bug Jan 20, 2026
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

Caution

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

⚠️ Outside diff range comments (1)
template/tinyvue/src/components/menu/index.vue (1)

102-125: Guard tree access against null nodes and invalid keys.
When findId() returns -1 (menu path not found), calling tree.value.setCurrentKey(-1) and then destructuring tree.value.getCurrentNode() will fail since getCurrentNode() returns null for an unmatched key. Add checks to prevent runtime errors.

🛠️ Suggested fix
      const key = findId(tabStore.current.name, tabStore.current.link)
+     if (key === -1) {
+       return
+     }
      tree.value.setCurrentKey(key)
-     const { parentId = null } = tree.value.getCurrentNode()
+     const currentNode = tree.value.getCurrentNode?.()
+     if (!currentNode) {
+       return
+     }
+     const { parentId = null } = currentNode
      if (parentId && !expandeArr.value.includes(parentId)) {
        expandeArr.value = expandeArr.value.concat(parentId)
      }
🤖 Fix all issues with AI agents
In `@template/tinyvue/src/components/menu/index.vue`:
- Around line 45-48: The call to getMenuList on the menuStore can reject and is
currently unhandled; update the usage of useMenuStore/getMenuList to handle
promise rejections (either await getMenuList() inside an async setup or attach
.catch(...) to getMenuList()) and surface/report errors via your app-level error
service or processLogger; ensure rawMenuData (computed(() =>
useDeepClone(unref(menuStore.menuList)))) remains unchanged but only depends on
menuStore.menuList after getMenuList resolution so the UI won't silently fail
when getRoleMenu/network errors occur.
🧹 Nitpick comments (1)
template/tinyvue/src/components/theme/index.vue (1)

2-6: Validate THEME injection and icon factory usage.
Ensure THEME is always provided; otherwise theme can be undefined at runtime. Also confirm the iconYes() factory is the expected @opentiny/vue-icon API.

✅ Optional explicit assertion
-const theme = inject<TinyThemeTool>('THEME')
+const theme = inject<TinyThemeTool>('THEME')!

Also applies to: 42-45

Comment on lines +45 to +48
const menuStore = useMenuStore()
menuStore.getMenuList()
const rawMenuData = computed(() => useDeepClone(unref(menuStore.menuList)))
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, find the store file containing getMenuList
fd -t f -e ts -e js -e vue | xargs rg -l 'getMenuList\b' | head -20

Repository: opentiny/tiny-pro

Length of output: 375


🏁 Script executed:

#!/bin/bash
# Search for getMenuList definition and its implementation
rg -n -B2 -A10 'getMenuList\s*\(' -g '*.{ts,js,vue}' | head -100

Repository: opentiny/tiny-pro

Length of output: 7307


🏁 Script executed:

#!/bin/bash
# Also check the menu store file structure
fd -t f 'menu' -type f | grep -i store

Repository: opentiny/tiny-pro

Length of output: 231


🏁 Script executed:

#!/bin/bash
# Find getRoleMenu implementation
rg -n -B2 -A8 'getRoleMenu' -g '*.{ts,js}' | head -80

Repository: opentiny/tiny-pro

Length of output: 2295


🏁 Script executed:

#!/bin/bash
# Check for global error handlers (unhandledrejection, error boundaries, etc.)
rg -n 'unhandledrejection|onUnhandledRejection|errorHandler|captureException' -g '*.{ts,js,vue}' | head -30

Repository: opentiny/tiny-pro

Length of output: 130


🏁 Script executed:

#!/bin/bash
# Check menu/index.vue more completely to see if there's any error handling context
cat -n template/tinyvue/src/components/menu/index.vue | head -80

Repository: opentiny/tiny-pro

Length of output: 2863


Handle possible getMenuList() rejections from unhandled promise.

getMenuList() is called without await or .catch() and can reject if getRoleMenu fails (network error, server error, etc.). The rejection will be unhandled since Vue's global error handler does not catch unhandled promise rejections. The menu will silently fail to load. Add error handling:

-menuStore.getMenuList()
+menuStore.getMenuList().catch((err) => {
+  console.error('Failed to load menu list', err)
+})

Alternatively, if using an app-level error reporting service, handle the rejection there.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const menuStore = useMenuStore()
menuStore.getMenuList()
const rawMenuData = computed(() => useDeepClone(unref(menuStore.menuList)))
const menuStore = useMenuStore()
menuStore.getMenuList().catch((err) => {
console.error('Failed to load menu list', err)
})
const rawMenuData = computed(() => useDeepClone(unref(menuStore.menuList)))
🤖 Prompt for AI Agents
In `@template/tinyvue/src/components/menu/index.vue` around lines 45 - 48, The
call to getMenuList on the menuStore can reject and is currently unhandled;
update the usage of useMenuStore/getMenuList to handle promise rejections
(either await getMenuList() inside an async setup or attach .catch(...) to
getMenuList()) and surface/report errors via your app-level error service or
processLogger; ensure rawMenuData (computed(() =>
useDeepClone(unref(menuStore.menuList)))) remains unchanged but only depends on
menuStore.menuList after getMenuList resolution so the UI won't silently fail
when getRoleMenu/network errors occur.

@vaebe
Copy link
Contributor Author

vaebe commented Jan 20, 2026

这个 pr 就先改这么多吧

@kagol kagol merged commit 647cb0f into opentiny:dev Jan 20, 2026
2 checks passed
@vaebe vaebe deleted the fix-icon-load branch January 20, 2026 08:49
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.

2 participants