Repository navigation
fix(llc): keep drafts saved or deleted while offline #3115
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
xsahil03x
merged 23 commits into
master
from
sahil/flu-1086-a-draft-typed-while-offline-is-lost-drafts-are-only-saved
Oct 27, 2026
+83
−14
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
5fd710f
test(e2e): add e2e_app, port native e2e suites, one app process per C…
testableapple 0b8aa6d
chore(repo): ignore e2e mock server, Allure results and allurectl in …
testableapple b4979e4
test(repo): link every e2e test to its Allure TestOps case
testableapple b71afe2
Merge remote-tracking branch 'origin/master' into test/e2e-native-parity
testableapple b03e78e
test(repo): unmount the e2e app before resetting the client, verify c…
testableapple 3bb8bd3
ci(repo): run PR e2e on API 36, use a preinstalled NDK, retry failed …
testableapple e7510b3
test(repo): retype into a field that ignored the text
testableapple 1e75428
test(repo): keep the copied message id in the e2e app, bound the vid…
testableapple 4b7a5fa
Merge branch 'master' into test/e2e-native-parity
testableapple 8d9cef2
test(repo): scroll until a message is on screen, stop when the emulat…
testableapple 0e4da80
ci(repo): give the e2e app's Gradle the sample app's memory settings
testableapple 4a66a48
Bump timeout
testableapple ab90f31
test(repo): restart a dead emulator during the e2e run
testableapple c883599
test(repo): time-limit e2e runs so a dead emulator can't hang the job
testableapple 87586b9
fix(repo): look up timeout through sh so the lane runs on Linux
testableapple d42a93a
ci(repo): split the e2e coverage nightly into 4 batches
testableapple 8e73290
ci(repo): give the e2e runners memory headroom
testableapple b6acb2a
test(repo): retry the tap that opens the image gallery
testableapple cee7d12
fix(llc): keep drafts saved or deleted while offline
xsahil03x 6549954
Merge remote-tracking branch 'origin/test/e2e-native-parity' into sah…
xsahil03x bcb16c1
test(repo): enable the offline draft e2e test (FLU-1086)
xsahil03x a3fb39b
refactor(llc): build the local draft before storing it
xsahil03x b7dccf7
Merge remote-tracking branch 'origin/master' into sahil/flu-1086-a-dr…
xsahil03x File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.
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.
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.
Script executed:
rg -n -C 12 'updateDraft|deleteDraft' packages/stream_chat/lib/src/client/channel/channel_client_state.dart packages/stream_chat/lib/src/client/channel/channel.dartRepository: GetStream/stream-chat-flutter
Length of output: 9435
Clear local draft state before awaiting persistence.
Channel.deleteDraftcallsChannelClientState.deleteDraftwithout awaiting it.deleteDraftawaits persistence before clearing state, so an immediatecreateDraftcan write a replacement that the pending deletion later removes. A persistence failure can also skip the local clear whileChannel.deleteDraftreturns only the API future.Move the local state update before the persistence await.
Suggested fix
void deleteDraft(Draft draft) async { - // Delete the draft from the persistence client. - await _client.chatPersistenceClient?.deleteDraftMessageByCid( - draft.channelCid, - parentId: draft.parentId, - ); - if (draft.parentId case final parentId?) { final parent = messages.firstWhereOrNull((it) => it.id == parentId); - if (parent == null) return; - return updateMessage(parent.copyWith(draft: null)); + if (parent != null) { + updateMessage(parent.copyWith(draft: null)); + } + } else { + updateChannelState( + channelState.copyWith( + draft: null, + ), + ); } - updateChannelState( - channelState.copyWith( - draft: null, - ), + // Delete the draft from the persistence client. + await _client.chatPersistenceClient?.deleteDraftMessageByCid( + draft.channelCid, + parentId: draft.parentId, ); }