Repository navigation
fix(search): do not warn when limit is false - #669
Open
feritcemkahraman wants to merge 1 commit into
Open
feritcemkahraman wants to merge 1 commit into
feritcemkahraman wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
校验条件与测试 src/hooks/useSearchConfig.ts, tests/search.spec.tsx |
limit 为 false 时跳过非正数校验。新增测试验证此配置不会调用 console.error,并在测试结束时恢复该方法。 |
Priority:
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Merge Risk: 
Minimal · up to bf3e2
-
The supported false limit now avoids the erroneous warning and remains mergeable.
Pre-merge checks: 
5
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
兔子翻开搜索页,
看到 limit 写着 false。
校验绕开这条路,
测试安静不报错。
兔耳轻摇收好键,
蹦跳回家吃青草。
Comment @coderabbitai help to get the list of available commands.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves #414.
In
useSearchConfig, the validation check(searchConfig.limit as number) <= 0evaluated totruewhenlimit: falsewas configured becausefalse <= 0istruein JavaScript. This triggered a false warning ('limit' of showSearch should be positive number or false.) even thoughlimit: falseis valid and supported to disable the limit.Changes
searchConfig.limit !== false && (searchConfig.limit as number) <= 0before triggering the warning and resetting limit tofalse.tests/search.spec.tsxverifying thatlimit: falsedoes not log a warning.Closes #414.
Summary by CodeRabbit