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

Filter by whole file path instead of file name #176

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

wboult
Copy link

@wboult wboult commented Sep 19, 2021

Updates the filter logic to filter by the whole file path instead of just the file name.

Example:
Animation

Closes #175


if (!show) {
return null
}

const filtered = createFileTree(filter).tree
Copy link
Author

Choose a reason for hiding this comment

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

Originally I didn't have this here, but when the tree was reloaded for a reason other than the filter changing (e.g. sync button pressed, or "viewed" checkbox clicked) it would add back folders that should not be visible.

Not sure if this is the best way to address that, but it seems to work fine.

@@ -7,12 +7,28 @@ class Folder extends React.Component {
this.state = {}
}

getHighlight ({ nodeLabel, filter, index }) {
Copy link
Author

Choose a reason for hiding this comment

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

I did try and move this to the shared lib.js but it didn't work because of the React stuff, so settled for just having a copy in Folder

let location = tree
if (filterItem(parts[parts.length - 1], filter)) {
if (filterItem(title, filter)) {
Copy link
Author

Choose a reason for hiding this comment

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

this is the main change, I haven't made it optional but I'm happy to if you'd like

@berzniz
Copy link
Owner

berzniz commented Sep 19, 2021

Thanks I will review soon

@kopach
Copy link

kopach commented Dec 21, 2021

Hi @berzniz, any chance to have this merged any soon (along with other PR's)? This looks really useful.

@berzniz
Copy link
Owner

berzniz commented Jan 7, 2022

Hi @kopach - I won't be able to merge this to the upcoming 1.0.36 version. There are two main things:

  1. I need to understand the logic better and see how to move createFileTree out of the main render flow.
  2. Adding this with an optional flag. There might be people who will prefer to turn this off

@berzniz berzniz added this to the 2.0.0 milestone Jan 7, 2022
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.

Extra features for large PR workflow
3 participants