Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3a520d5

Browse files
authored
fix: canvas preview panic in Xcode resolved (#82)
The preview was panicking because the app state had an optional base URL, which is getting unwrapped elsewhere. This creates an app state and then 'logs in' to set the base URL, reenabling the preview.Change-Id: I8d6a19063a13f772dc409bc5e523e1af9c109beeSigned-off-by: Thomas Kosiewski <tk@coder.com>
1 parent5b4b174 commit3a520d5

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

‎Coder Desktop/Coder Desktop/State.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class AppState: ObservableObject {
2525
// Stored in Keychain
2626
@Publishedprivate(set)varsessionToken:String?{
2727
didSet{
28+
guard persistentelse{return}
2829
keychainSet(sessionToken, for:Keys.sessionToken)
2930
}
3031
}

‎Coder Desktop/Coder Desktop/Views/LoginForm.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,6 @@ enum LoginField: Hashable {
221221
#if DEBUG
222222
#Preview{
223223
LoginForm()
224-
.environmentObject(AppState())
224+
.environmentObject(AppState(persistent:false))
225225
}
226226
#endif

‎Coder Desktop/Coder Desktop/Views/VPNMenu.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,12 @@ func openSystemExtensionSettings() {
104104

105105
#if DEBUG
106106
#Preview{
107-
VPNMenu<PreviewVPN>().frame(width:256)
107+
letappState=AppState(persistent:false)
108+
appState.login(baseAccessURL:URL(string:"http://127.0.0.1:8080")!, sessionToken:"")
109+
// appState.clearSession()
110+
111+
returnVPNMenu<PreviewVPN>().frame(width:256)
108112
.environmentObject(PreviewVPN())
109-
.environmentObject(AppState(persistent:false))
113+
.environmentObject(appState)
110114
}
111115
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp