clear app db of channel messages on delete#196
Conversation
we were only deleting channels and messages on device and the in app db would persist this caused weird messages to later show up in other channels as they were deleted and added due to the fact we store messages by channel index(slot #)
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4bf2519559
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| onPressed: () { | ||
| Navigator.pop(dialogContext); | ||
| connector.deleteChannel(channel.index); | ||
| channelMessageStore.clearChannelMessages(channel.index); |
There was a problem hiding this comment.
Remove unconditional local purge on channel delete
clearChannelMessages now runs immediately after kicking off connector.deleteChannel, so local history is deleted even when the device-side delete fails (for example, a transient BLE disconnect causes sendFrame in MeshCoreConnector.deleteChannel to throw before the channel is actually removed). In that case the channel still exists on-device after reconnect, but its app-side message history has already been erased, which is user-visible data loss.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
We don't check for failure as it is
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e1cb0482f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| onPressed: () { | ||
| Navigator.pop(dialogContext); | ||
| connector.deleteChannel(channel.index); | ||
| channelMessageStore.clearChannelMessages(channel.index); |
There was a problem hiding this comment.
Clear channel history only after delete succeeds
Calling channelMessageStore.clearChannelMessages(channel.index) immediately after firing connector.deleteChannel(...) deletes local history even when the device-side delete fails (for example, a BLE disconnect before sendFrame completes). Fresh evidence: MeshCoreConnector.deleteChannel already clears stored messages after a successful delete frame, so this new call bypasses that success gate and can erase chats for channels that still exist on-device.
Useful? React with 👍 / 👎.
we were only deleting channels and messages on device and the in app db would persist this caused weird messages to later show up in other channels as they were deleted and added due to the fact we store messages by channel index(slot #)
closes #189