Conversation
hiimtmac
force-pushed
the
tm/support-local-pins
branch
from
September 9, 2026 20:36
c59f7b6 to
fd845fe
Compare
kari-ts
reviewed
Sep 10, 2026
hiimtmac
force-pushed
the
tm/support-local-pins
branch
from
September 11, 2026 14:45
fd845fe to
8c53571
Compare
hiimtmac
force-pushed
the
tm/support-local-pins
branch
from
September 11, 2026 15:14
8c53571 to
ed0eaf8
Compare
barnstar
requested changes
Sep 14, 2026
barnstar
left a comment
Member
There was a problem hiding this comment.
Looks good - just one small issue with the write serialization. I think we should also add the long press gesture the the search results if that's possible - though we can do that in a follow-up.
| revert = null | ||
| _writing.value = true | ||
|
|
||
| val result = suspendCancellableCoroutine { cont -> |
Member
There was a problem hiding this comment.
Tangential to this PR, but the client API functions not being suspend fun's is maybe something we should consider changing to avoid the use of continuations here.
| } | ||
|
|
||
| private suspend fun write(request: FavoritesRequest) { | ||
| val snapshot = revert |
Member
There was a problem hiding this comment.
This is missing a try-catch in case the the suspendCancellableCoroutine is cancelled... But it may make more sense to track the job and cancel that. Or just wrap the contents of write() in a mutex.
private var writeJob: Job? = null
fun enqueueWrite(request: FavoritesRequest) {
writeJob?.cancel()
writeJob = viewModelScope.launch {
write(request)
}
}
private suspend fun write(request: FavoritesRequest) {
val snapshot = _favorites.value
val profile = currentProfile
_writing.value = true
try {
val result = suspendCancellableCoroutine { cont ->
val call = client.setFavorites(request) { cont.resume(it) }
}
if (currentProfile != profile) return
result.onFailure {
TSLog.e(TAG, "Error writing favorites: ${it.message}")
_favorites.value = snapshot
}
} finally {
_writing.value = false
}
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for device pinning - from device list and from peer detail
Match iOS long push menu - ipv4/ipv6/magic DNS, update icon and reorder
Fixes https://github.com/tailscale/corp/issues/47581
Fixes https://github.com/tailscale/corp/issues/47582
Screen_Recording_20260904_110411.mp4