Skip to content

Conversation

@GaoNeng-wWw
Copy link
Collaborator

@GaoNeng-wWw GaoNeng-wWw commented Sep 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?

后端根据角色筛选的时候需要的是role而不是roleIds

Issue Number: N/A

What is the new behavior?

将,roleIds改为role

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Bug Fixes
    • Prevents crashes when applying user filters containing undefined values.
    • Corrects role-based filtering in User Manager to accurately reflect selected roles.
    • Improves stability and reliability of user search/filtering operations.

@coderabbitai
Copy link

coderabbitai bot commented Sep 3, 2025

Walkthrough

Adds a guard in getAllUser to skip undefined filter entries and an ESLint disable for continue. Updates info-tab.vue fetchData to normalize filters: pass arrays as-is; for objects, spread and map role to filters.roleIds. No exported signatures changed.

Changes

Cohort / File(s) Summary of Changes
API filter guard
template/tinyvue/src/api/user.ts
Added check to continue loop when a filter value is undefined, preventing access to properties on undefined (e.g., value.type). Included an ESLint disable comment for continue usage. No other control flow or signature changes.
UI filter normalization
template/tinyvue/src/views/userManager/info/components/info-tab.vue
In fetchData, normalized filters before calling getAllUser: arrays passed through; objects spread and role set to filters.roleIds, altering how role filtering is sent to backend.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant V as info-tab.vue (fetchData)
  participant A as getAllUser (api/user.ts)
  participant B as Backend

  U->>V: Trigger data fetch
  Note over V: Normalize filters<br/>- If Array: use as-is<br/>- If Object: {...filters, role: filters.roleIds}
  V->>A: getAllUser(normalizedFilters)

  Note over A: Iterate filters<br/>Skip entries where value is undefined
  A->>B: Request users with processed filters
  B-->>A: Users data
  A-->>V: Users data
  V-->>U: Render results
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I nibbled on filters, crisp and clean,
Hopped past undefined—left the scene.
Arrays glide through, objects re-role,
Backend burrows, fetches the whole.
With one swift skip and tidy tune,
Our queries bloom beneath the moon. 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • 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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the bug Something isn't working label Sep 3, 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: 0

🧹 Nitpick comments (1)
template/tinyvue/src/api/user.ts (1)

62-65: Skip nullish filters and remove ESLint suppression (no-continue)
Current guard only handles undefined and requires disabling no-continue. Recommend handling both null/undefined and restructuring to avoid continue and the linter disable.

-    if (value === undefined) {
-      // eslint-disable-next-line no-continue
-      continue;
-    }
-    if (value.type === 'enum') {
+    // Skip nullish filter entries
+    if (value == null) {
+      // do nothing
+    } else if (value.type === 'enum') {
       if (Array.isArray(value.value) && value.value.length) {
         params.set(key, value.value.toString());
       }
     }
-    if (value.type === 'input' && !Array.isArray(value.value)) {
+    if (value && value.type === 'input' && !Array.isArray(value.value)) {
       let sql = `${value.value.relation === 'contains' ? '%' : ''}${value.value.text}${value.value.relation === 'startwith' || value.value.relation === 'contains' ? '%' : ''}`;
       params.set(key, sql);
     }

Also applies to: 66-75

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8fb67f3 and 821851f.

📒 Files selected for processing (2)
  • template/tinyvue/src/api/user.ts (1 hunks)
  • template/tinyvue/src/views/userManager/info/components/info-tab.vue (1 hunks)
🔇 Additional comments (1)
template/tinyvue/src/views/userManager/info/components/info-tab.vue (1)

546-549: Rename roleIds to role via key mapping
Use Object.fromEntries(Object.entries(filters ?? {}).map(([k,v]) => [k==='roleIds'?'role':k, v])) to drop roleIds and emit only role. Confirm the request URL contains role=… and no roleIds.

@kagol kagol merged commit 6e8940d into opentiny:dev Sep 10, 2025
3 checks passed
kagol added a commit that referenced this pull request Sep 28, 2025
* style: remove console.log (#57)

* feat: change the style of the home page and menu page (#51)

* feat: change the style of the home page and menu page

* feat: revise inspection comments

* feat: Optimize the query table page, add corresponding functions, and modify the overall margin layout of Pro (#50)

* feat: 优化查询表格页面,增加相应功能,修改pro整体边距布局

* feat: 优化数据算法

* fix: 根据意见修改页面查询表格、用户管理、国际化管理页面 (#59)

* fix: 根据意见修改页面查询表格、用户管理、国际化管理页面

* fix: 统一分页pageSizes配置

* fix:修复刷新后表单数据丢失导致校验报错 (#58)

* fix:表单校验以及分页条目修改 (#61)

* feat: 监控页样式修改和解决初始化问题 (#60)

* feat: change the style of the home page and menu page

* feat: revise inspection comments

* feat: 监控页样式修改和解决初始化问题

* feat: 修改表格pageSizes格式

* fix: 表格和弹出框优化 (#62)

* fix: 表格和弹出框优化

* fix: 增加国际化

* feat: 解决查看菜单下级不能展开的问题 (#63)

* fix:i18n (#70)

* fix(web): data struct (#76)

* fix(web): select change (#81)

* fix(web): select change

* feat: uncomment search-box style

* fix(tiny-vue): user-manageer info-tab role id select

* fix(tiny-pro): if role id is undefined will send empty array not [null] (#83)

* fix(nestJS): added lost permissions (#89)

* fix(web): if not batch-remove should not display i18n or user batch-remove button (#90)

* chore: add `--no-frozen-lockfile` (#91)

* chore: release v1.3.0 (#95)

* fix:历史记录功能恢复 (#98)

* fix: fix tabs style (#100)

* fix(web): role table pager (#97)

* fix(web): role table pager

* chore: change default page-size to `10`

* fix(web): role filter (#99)

* feat: 支持初始化低代码设计器

---------

Co-authored-by: GaoNeng <31283122+GaoNeng-wWw@users.noreply.github.com>
Co-authored-by: wuyiping <42107997+wuyiping0628@users.noreply.github.com>
Co-authored-by: chenxi-20 <2465950588@qq.com>
Co-authored-by: liukun <953831480@qq.com>
Co-authored-by: Kagol <kagol@sina.com>
@GaoNeng-wWw GaoNeng-wWw deleted the fix/role-filter branch November 28, 2025 12:37
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