Skip to content

Commit

Permalink
Fixed a small race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
austincondiff committed Nov 2, 2024
1 parent 996be19 commit 52b03ef
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,20 @@ class IgnorePatternModel: ObservableObject {
try? content.write(to: fileURL, atomically: true, encoding: .utf8)
}

@MainActor
func addPattern() {
if patterns.isEmpty {
Task {
await setupGlobalIgnoreFile()
}
}
patterns.append(GlobPattern(value: ""))
savePatterns()
Task {
savePatterns()
}
}

@MainActor
func removePatterns(_ selection: Set<GlobPattern>? = nil) {
let patternsToRemove = selection ?? self.selection
patterns.removeAll { patternsToRemove.contains($0) }
Expand Down

0 comments on commit 52b03ef

Please sign in to comment.