Skip to content

Commit 9c3840d

Browse files
committed
Update
1 parent 353c686 commit 9c3840d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

Tool/Sources/Workspace/OpenedFileRocoverableStorage.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,19 @@ public final class OpenedFileRecoverableStorage {
1515
var openedFiles = Set(dict[projectRootURL.path] as? [String] ?? [])
1616
openedFiles.insert(fileURL.path)
1717
dict[projectRootURL.path] = Array(openedFiles)
18-
userDefault.set(dict, forKey: key)
18+
Task { @MainActor [dict] in
19+
userDefault.set(dict, forKey: key)
20+
}
1921
}
2022

2123
public func closeFile(fileURL: URL) {
2224
var dict = userDefault.dictionary(forKey: key) ?? [:]
2325
var openedFiles = dict[projectRootURL.path] as? [String] ?? []
2426
openedFiles.removeAll(where: { $0 == fileURL.path })
2527
dict[projectRootURL.path] = openedFiles
26-
userDefault.set(dict, forKey: key)
28+
Task { @MainActor [dict] in
29+
userDefault.set(dict, forKey: key)
30+
}
2731
}
2832

2933
public var openedFiles: [URL] {

0 commit comments

Comments
 (0)