-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Implement filtering on story-level #1432
Implement filtering on story-level #1432
Conversation
Nice tests--great work!!! |
Codecov Report
@@ Coverage Diff @@
## release/3.2 #1432 +/- ##
==============================================
+ Coverage 15.91% 16% +0.09%
==============================================
Files 237 237
Lines 5047 5054 +7
Branches 698 624 -74
==============================================
+ Hits 803 809 +6
- Misses 3671 3730 +59
+ Partials 573 515 -58
Continue to review full report at Codecov.
|
if (fuzzysearch(needle, hstack)) return acc.concat(kindInfo); | ||
|
||
// Now search at individual story level and filter results | ||
const matchedStories = kindInfo.stories.filter(story => fuzzysearch(needle, story)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO you should add the lowercasing here (like for the kind
check, looks like fuzzysearch
already do ===
, so it maybe redundant) And add tests for this usecase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fuzzy search takes care of that, I think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't look so - https://github.com/bevacqua/fuzzysearch/blob/master/index.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checked the fork and now I'm confident that without lowercasing it won't actually work.
@ndelangen I can confirm that @igor-dv is correct on the case issue. When filtering at individual story level converting to lower case is required. Its not covered by fuzzysearch. As mentioned by some users this fork does not seem be working correctly. Any advice on how to get this working is greatly appreciated. I have it working on local after |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool.
Checked it in |
This may need some further work before it's ready. My feeling is that it would be better if the directories expanded to show remaining stories after filtering. Currently it seems hard to predict if react-treebeard will display a result as expanded or not after filtering. I'll look into it further. |
@jhurley23 @igor-dv @ndelangen can confirm that the reason it's working with manual linking but not with If you update the
|
@jhurley23 agree with you on the expansion behavior. may take some work to get this right! |
My patch on lerna would fix that 😭 |
@jhurley23 @igor-dv would love to get this in for 3.2. Should I merge as is and we handle the hierarchy expansion behavior in a separate PR (preferably on a branch inside this repo?) Or do you want to try to add that before I merge? |
Let's think if it's a blocker ? I prefer to merge this one, and to implement the expansion in separate PR. |
@jhurley23 @igor-dv OK i've merged this one in. I don't think this is a blocker, but it would be really awesome to get it fixed fully as part of the 3.2 release! |
Issue:
#109
What I did
I edited the
storyFilter()
function to enable filtering on the story-level.If the "fuzzysearch" matches a storiesOf() level story it will return all stories that are matched.
If the fuzzysearch matches an individual story, it will just return that story.
It will leave the currently active story unfiltered
How to test
See the additions to
filters.test.js
for examples of it in action.