Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Table): fix isFilterValueExist function deal null value error #3197

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

2ue
Copy link

@2ue 2ue commented Nov 13, 2024

✅ Closes: 3196

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

#3196

💡 需求背景和解决方案

📝 更新日志

  • fix(Table): 修复可过滤表格在处理null类型的异常问题

  • 本条 PR 不需要纳入 Changelog

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

Copy link
Contributor

github-actions bot commented Nov 13, 2024

完成

@HaixingOoO
Copy link
Collaborator

/update-snapshot

Copy link
Contributor

⏳ 正在运行快照更新。。。 CI: Open

@uyarn uyarn changed the title fix: 🐛 isFilterValueExist function deal null value error fix(Table): fix isFilterValueExist function deal null value error Nov 14, 2024
@uyarn
Copy link
Collaborator

uyarn commented Nov 15, 2024

issue提到的 "并且还发现其他问题:如果值为字符串undefined和字符串null会导致误判,误判代码"
看原来的逻辑,是先把value都string一遍 所以是'undefined'和'null' 为什么会是误判呢?

@2ue
Copy link
Author

2ue commented Nov 15, 2024

issue提到的 "并且还发现其他问题:如果值为字符串undefined和字符串null会导致误判,误判代码" 看原来的逻辑,是先把value都string一遍 所以是'undefined'和'null' 为什么会是误判呢?

如果传入的值本身就是'null'或者'undefined',就会被误判成空,但实际上不应该为空

// 之前的函数会输出为false,实际应该输出为true
isFilterValueExist('null')

这种很常见,比如有些昵称就被人为的设置成了'null'

所以这个函数最后一行代码被修改成了:![null, '', undefined].includes(value)

当然肯定存在在某些情况下我们需要把'null'和'undefined'识别为空,来过滤某些数据,但个人认为这应该交给具体业务场景来处理了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants