Skip to content

Commit

Permalink
fix: Ensure views update dynamically during initial indexing (#17)
Browse files Browse the repository at this point in the history
This fixes a bug where `OrFilter` was incorrectly failing to check the
rhs.
  • Loading branch information
jbmorley authored Feb 10, 2024
1 parent 655c0d5 commit e8168e0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Folders/Utilities/DirectoryScanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class DirectoryScanner {
switch event {
case .itemClonedAtPath:
return
case .itemCreated(path: let path, itemType: let itemType, eventId: _, fromUs: _):
case .itemCreated(path: let path, itemType: _, eventId: _, fromUs: _):
print("File created at path '\(path)'")
do {
onFileCreation(try FileManager.default.details(for: path))
Expand Down
5 changes: 0 additions & 5 deletions Folders/Utilities/DirectoryWatcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ class DirectoryWatcher: NSObject, StoreObserver {
func store(_ store: Store, didInsert details: Details) {
dispatchPrecondition(condition: .notOnQueue(.main))

// Ignore updates that don't match our filter (currently just the parent URL).
guard url.path.starts(with: self.url.path) else {
return
}

DispatchQueue.main.async {
guard self.filter.matches(details: details) else {
return
Expand Down
4 changes: 2 additions & 2 deletions Folders/Utilities/Filter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ struct OrFilter<A: Filter, B: Filter>: Filter {
}

func matches(details: Details) -> Bool {
return lhs.matches(details: details) || lhs.matches(details: details)
return lhs.matches(details: details) || rhs.matches(details: details)
}

}
Expand Down Expand Up @@ -120,7 +120,7 @@ struct ParentFilter: Filter {
}

func matches(details: Details) -> Bool {
details.url.path.starts(with: parent)
return details.url.path.starts(with: parent)
}

}
Expand Down
2 changes: 1 addition & 1 deletion Folders/Utilities/Store.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Store {
static let subtype = Expression<String?>("subtype")
}

static let majorVersion = 7
static let majorVersion = 17

var observers: [StoreObserver] = []

Expand Down

0 comments on commit e8168e0

Please sign in to comment.