-
Notifications
You must be signed in to change notification settings - Fork 4
Improve delete all flow #237
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
base: dev
Are you sure you want to change the base?
Conversation
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
ed2051a to
276766e
Compare
|
Claude finished @yewreeka's task —— View job Code Review: Improve delete all flowI've completed a thorough review of PR #237. Overall, this is a well-structured implementation that adds a nice UX improvement for the delete-all flow. However, there are several critical bugs and improvements needed before merge. 🔴 Critical Issues1. Missing
|
276766e to
62dbe3c
Compare
62dbe3c to
b4b73d5
Compare
|
|
||
| QuicknameSettingsViewModel.shared.delete() | ||
|
|
||
| Task { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Task in deleteAllData isn’t tracked. If this view model deallocates during deletion, onComplete() can still fire and drive UI on a dead screen. Consider storing the task and cancelling it in deinit or when appropriate to avoid running completion after teardown.
🚀 Reply to ask Macroscope to explain or update this suggestion.
👍 Helpful? React to give us feedback.
Replace destructive confirmation dialog with a non-dismissible self-sizing sheet and hold-to-delete flow for deleting all app data in
AppSettingsViewIntroduce
AppSettingsViewModelto manage delete-all progress and errors, presentDeleteAllDataViewvia a sheet with a 3-second hold-to-delete button, route session deletion throughSessionManagerProtocol.deleteAllInboxesWithProgress(), and addwaitForDeletionComplete()across inbox and messaging layers.📍Where to Start
Start with the delete-all flow entry in
AppSettingsViewand its view model: AppSettingsView.swift and AppSettingsViewModel.swift. Then review the progress stream in SessionManager.swift.📊 Macroscope summarized 948435a. 17 files reviewed, 11 issues evaluated, 9 issues filtered, 1 comment posted
🗂️ Filtered Issues
Convos/App Settings/AppSettingsView.swift — 0 comments posted, 1 evaluated, 1 filtered
quicknameViewModel.delete()call that was present in the old confirmation dialog. The old code explicitly deleted the quickname when the user confirmed deletion, but the newDeleteAllDataViewonly callsviewModel.deleteAllData(onComplete:)without any reference toquicknameViewModel. UnlessAppSettingsViewModel.deleteAllDatainternally handles quickname deletion, the quickname data will no longer be deleted when the user chooses to delete all app data, despite the UI stating "This will permanently delete all conversations on this device, as well as your Quickname." [ Low confidence ]Convos/App Settings/AppSettingsViewModel.swift — 1 comment posted, 2 evaluated, 1 filtered
isDeletingis never reset tofalseafter successful deletion. The variable is set totrueat the start ofdeleteAllData, but only thecatchblock resets it tofalse. On success,onComplete()is called butisDeletingremainstrue. This will cause theguard !isDeleting else { return }check to silently reject all subsequent deletion attempts. [ Already posted ]Convos/Conversations List/ConversationsView.swift — 0 comments posted, 2 evaluated, 1 filtered
quicknameViewModel.delete(). The oldconfirmationDialogimplementation explicitly calledquicknameViewModel.delete()beforeonDeleteAllData(), but the newselfSizingSheetwithDeleteAllDataViewonly callsdismiss()andonDeleteAllData()inonComplete. UnlessDeleteAllDataViewinternally handles quickname deletion, user quickname data may not be properly deleted when the user deletes all app data. [ Already posted ]Convos/Conversations List/ConversationsViewModel.swift — 0 comments posted, 2 evaluated, 2 filtered
isDeletingis never set tofalseon the success path indeleteAllData(). It's only reset in thecatchblock. After a successful deletion completes,isDeletingremainstrueforever, which would leave the UI in a stuck state if the view is reused or ifonCompletedoesn't dismiss the view. [ Already posted ]deleteAllData(),selectedConversationis set tonilsynchronously beforeappSettingsViewModel.deleteAllData()is called, but the actual deletion is asynchronous. If the deletion fails, the user's selection is already cleared even though their data wasn't deleted, causing inconsistent UI state. [ Already posted ]Convos/Shared Views/HoldToConfirmButton.swift — 0 comments posted, 1 evaluated, 1 filtered
config.durationis set to0or a negative value, line 69 performs a division by zero or produces negative/NaN progress values. This would causescaleEffect(currentProgress)at line 93 to behave incorrectly (infinite scale or negative scale). Additionally,onLongPressGesture(minimumDuration:)at line 103 may exhibit undefined behavior with non-positive duration values. [ Low confidence ]ConvosCore/Sources/ConvosCore/Inboxes/InboxStateMachine.swift — 0 comments posted, 1 evaluated, 1 filtered
waitForDeletionComplete()may hang indefinitely if called when a deletion has not been initiated. If the state machine is in a state like.readyand nostopAndDelete()action is queued, the method will wait forever for a state transition to.idle,.stopping, or.errorthat may never occur. Consider adding a timeout or checking that a deletion is in progress before waiting. [ Already posted ]ConvosCore/Sources/ConvosCore/Inboxes/InboxStateManager.swift — 0 comments posted, 2 evaluated, 2 filtered
waitForDeletionComplete(): The method iterates overstateSequencewhich immediately yields the current state when the continuation is added. IfstopAndDelete()enqueues the delete action but the action hasn't been processed yet (still in.idlestate),waitForDeletionComplete()will see.idleas the first yielded state and return immediately, incorrectly thinking deletion is complete. This happens becauseenqueueAction(.delete)is fire-and-forget and the actual state transition occurs asynchronously in a separate Task. [ Already posted ]waitForDeletionComplete()whenstateMachineis nil: Unlike thedelete()method which throwsInboxStateError.inboxNotReadywhenstateMachineis nil, this method silently returns. Callers have no way to distinguish between successful deletion completion and the state machine being unavailable, which could lead to incorrect assumptions about deletion state. [ Low confidence ]