Skip to content

fix: canvas preview panic in Xcode resolved #82

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Coder Desktop/Coder Desktop/State.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class AppState: ObservableObject {
// Stored in Keychain
@Published private(set) var sessionToken: String? {
didSet {
guard persistent else { return }
Copy link
Member

Choose a reason for hiding this comment

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

This is already guarded in keychainSet

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh yes, it would have been wise of me to check that. 😅

I will keep it in for consistency with the setters above and below, as it appeared somewhat odd. This also ensures that we are doubly safe.

keychainSet(sessionToken, for: Keys.sessionToken)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Coder Desktop/Coder Desktop/Views/LoginForm.swift
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,6 @@ enum LoginField: Hashable {
#if DEBUG
#Preview {
LoginForm()
.environmentObject(AppState())
.environmentObject(AppState(persistent: false))
}
#endif
8 changes: 6 additions & 2 deletions Coder Desktop/Coder Desktop/Views/VPNMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,12 @@ func openSystemExtensionSettings() {

#if DEBUG
#Preview {
VPNMenu<PreviewVPN>().frame(width: 256)
let appState = AppState(persistent: false)
appState.login(baseAccessURL: URL(string: "http://127.0.0.1:8080")!, sessionToken: "")
// appState.clearSession()

return VPNMenu<PreviewVPN>().frame(width: 256)
.environmentObject(PreviewVPN())
.environmentObject(AppState(persistent: false))
.environmentObject(appState)
}
#endif
Loading