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(pro:search): mutiple search filed validation error #1475

Merged
merged 1 commit into from Feb 27, 2023

Conversation

sallerli1
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added/updated or not needed
  • Docs and demo have been added/updated or not needed

What is the current behavior?

当searchField允许重复,即配置了multiple时,第一个之后的搜索项合法性判断不正确

例如:第一个关键字会校验非空,空的会被删除掉,第二个关键字没有校验

What is the new behavior?

修复以上问题

Other information

@idux-bot
Copy link

idux-bot bot commented Feb 27, 2023

This preview will be available after the AzureCI is passed.

}

return searchState.segmentValues.every(segmentValue => !isNil(segmentValue.value))
// all validations are passed
return true
}

const validateSearchState = (key: VKey) => {
Copy link

Choose a reason for hiding this comment

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

the code review:

  1. In the first part of the code, it is important to check that the segmentValues are not undefined or null. This is a good way to prevent bugs from happening and make sure that the code runs smoothly.
  2. The second part of the code checks whether there are more than one searchState of the same field key and if multiple searchStates are allowed from the field config. This allows the code to be able to handle cases with multiple searchStates of the same field key.
  3. The last part of the code validates the searchState by checking that all segmentValues are not nil. This ensures that all validations are passed before the code is executed.

Overall, the code looks good and should be able to handle different cases without any issues. However, there might be some edge cases that are not addressed and should be considered in the future.

@codecov
Copy link

codecov bot commented Feb 27, 2023

Codecov Report

Merging #1475 (6587941) into main (4523705) will not change coverage.
The diff coverage is n/a.

❗ Current head 6587941 differs from pull request most recent head af87ad8. Consider uploading reports for the commit af87ad8 to get more accurate results

@@           Coverage Diff           @@
##             main    #1475   +/-   ##
=======================================
  Coverage   92.74%   92.74%           
=======================================
  Files         327      327           
  Lines       30426    30426           
  Branches     3497     3497           
=======================================
  Hits        28219    28219           
  Misses       2207     2207           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@danranVm danranVm merged commit b961c4e into IDuxFE:main Feb 27, 2023
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.

None yet

2 participants