   }
 
   func update(_ fileItem: FileItem) {
-    guard let fileBrowserItem = self.fileBrowserItem(with: fileItem.url) else {
-      return
-    }
-
-    Swift.print("\(fileItem.url) ->\n\(fileBrowserItem.fileItem)")
+    let url = fileItem.url
+    Swift.print("updating \(url)")
+    guard let fileBrowserItem = self.fileBrowserItem(with: url) else {
+      return
+    }
+
+    Swift.print("got \(fileBrowserItem) to update")
+//    self.update(fileBrowserItem)
+  }
+
+  fileprivate func update(_ fileBrowserItem: FileBrowserItem) {
+//    let url = fileBrowserItem.fileItem.url
+//
+//    let curChildren = fileBrowserItem.children.filter { !$0.fileItem.isHidden }
+//    let newChildren = (self.fileItemService.fileItemWithChildren(for: url)?.children ?? [])
+//        .map(FileBrowserItem.init)
+//        .filter { !$0.fileItem.isHidden }
+//
+//    Swift.print("\(fileBrowserItem.fileItem.url.lastPathComponent): \(curChildren.count) vs \(newChildren.count)")
+//
+//    let childrenToAdd = newChildren.filter { curChildren.contains($0) == false }
+//    let keptChildren = curChildren.filter { newChildren.contains($0) }
+//
+//    let resultChildren = childrenToAdd.add(keptChildren)
+//    fileBrowserItem.children = Array(resultChildren)
+//    Swift.print("new resulting children: \(resultChildren)")
+//
+//    let childrenToRecurse = keptChildren.filter{ self.isItemExpanded(self.fileBrowserItem(with: $0.fileItem.url)) }
+//    Swift.print("to recurse: \(childrenToRecurse)")
+//
+//    self.reloadItem(fileBrowserItem, reloadChildren: false)
+//
+//    childrenToRecurse.forEach(self.update)
   }
 
   fileprivate func fileBrowserItem(with url: URL) -> FileBrowserItem? {
+    if self.cwd == url {
+      return self.root
+    }
+
     guard self.cwd.isParent(of: url) else {
       return nil
     }

      self.root = FileBrowserItem(fileItem: rootFileItem)
      self.root.children = rootFileItem.children.map(FileBrowserItem.init)

      return self.root.children.filter { !$0.fileItem.isHidden }.count
    }

    guard let fileBrowserItem = item as? FileBrowserItem else {

// MARK: - NSOutlineViewDelegate
extension FileOutlineView {

  @objc(outlineView: viewForTableColumn:item:)
  func outlineView(_: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? {
    guard let fileBrowserItem = item as? FileBrowserItem else {
      return nil
