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

fix: improve file sync agent picker#128

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ethanndickson merged 4 commits intomainfromethan/rework-agent-picker
Apr 7, 2025

Conversation

ethanndickson
Copy link
Member

@ethanndicksonethanndickson commentedApr 3, 2025
edited
Loading

Previously, the agent/workspace picker when creating a file sync session had the user choose between instances of theAgent struct. This meant the value would get unselected were the status of the agent to change. I'm not sure why I had the picker select the entire struct instead of just the hostname.

sachk reacted with hooray emoji
@ethanndicksonGraphite App
Copy link
MemberAuthor

This stack of pull requests is managed byGraphite. Learn more aboutstacking.

@@ -107,9 +107,7 @@ struct FileSyncConfig<VPN: VPNService, FS: FileSyncDaemon>: View {
// When the Window is visible, poll for session updates every
// two seconds.
while !Task.isCancelled {
if !fileSync.state.isFailed {
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This is already checked inrefreshSessions.

@@ -55,15 +55,16 @@ struct FileSyncSessionModal<VPN: VPNService, FS: FileSyncDaemon>: View {
Button("Cancel", action: { dismiss() }).keyboardShortcut(.cancelAction)
Button(existingSession == nil ? "Add" : "Save") { Task { await submit() }}
.keyboardShortcut(.defaultAction)
.disabled(localPath.isEmpty || remotePath.isEmpty || chosenAgent == nil)
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This makes the form unsubmittable if any of the fields are trivially invalid.

Comment on lines 119 to 127
.task {
// If there's a file sync session error, an icon will be displayed
// next to the file sync button. The file sync window polls more
// frequently when it's open.
while !Task.isCancelled {
await fileSync.refreshSessions()
try? await Task.sleep(for: .seconds(15))
}
}
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Previously, we were only polling if the file sync window was open. We want the user to be aware of any errors at a glance, so we need to poll even when the window is closed.

@ethanndicksonethanndickson marked this pull request as ready for reviewApril 3, 2025 10:10
Copy link

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the file sync agent picker by switching from selecting an entire Agent struct to only using the hostname, ensuring that changes in Agent status do not inadvertently unselect the agent in an active session.

  • Adds an asynchronous task in VPNMenu to periodically refresh file sync sessions.
  • Updates FileSyncSessionModal to use a hostname string (chosenAgent) rather than the entire Agent struct for selection.
  • Removes a condition in FileSyncConfig to always refresh sessions regardless of fileSync.state.isFailed.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

FileDescription
Coder-Desktop/Coder-Desktop/Views/VPN/VPNMenu.swiftAdds a task to poll file sync sessions every 15 seconds.
Coder-Desktop/Coder-Desktop/Views/FileSync/FileSyncSessionModal.swiftRefactors agent selection to work with hostnames and updates UI bindings accordingly.
Coder-Desktop/Coder-Desktop/Views/FileSync/FileSyncConfig.swiftRemoves the condition that skipped refreshing sessions when a failure was detected.
Comments suppressed due to low confidence (2)

Coder-Desktop/Coder-Desktop/Views/FileSync/FileSyncConfig.swift:109

  • Removing the check for fileSync.state.isFailed may cause unnecessary refresh operations even when the file sync state indicates a failure. Consider reinstating or refining the condition to avoid redundant network calls.
while !Task.isCancelled {

Coder-Desktop/Coder-Desktop/Views/FileSync/FileSyncSessionModal.swift:11

  • [nitpick] The variable 'chosenAgent' could be more descriptive, for example, renaming it to 'chosenAgentHost' to clearly indicate that it holds a hostname.
@State private var chosenAgent: String?

@ethanndicksonGraphite App
Copy link
MemberAuthor

ethanndickson commentedApr 7, 2025
edited
Loading

Merge activity

  • Apr 7, 2:52 AM EDT: A user started a stack merge that includes this pull request viaGraphite.
  • Apr 7, 2:52 AM EDT: A user merged this pull request withGraphite.
sachk reacted with hooray emoji

@ethanndicksonethanndickson merged commit9f625fd intomainApr 7, 2025
4 checks passed
@ethanndicksonethanndickson deleted the ethan/rework-agent-picker branchApril 7, 2025 06:52
@ethanndicksonethanndickson self-assigned thisMay 23, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

@deansheatherdeansheatherdeansheather approved these changes

Assignees

@ethanndicksonethanndickson

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@ethanndickson@deansheather

[8]ページ先頭

©2009-2025 Movatter.jp