Skip to content
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

Fix converting deleted database objects #3497

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

laevandus
Copy link
Contributor

@laevandus laevandus commented Nov 19, 2024

🔗 Issue Links

Part of IOS-23
Resolves IOS-20

🎯 Goal

Fix issues around deleting objects in the local database

📝 Summary

  • Skip converting deleted database objects which lead to model objects returning empty properties
  • Do not delete muted users when the current user object is deleted which leads to channel members having inconsistent state (member's user data is empty)
  • Skip willSave if the DTO is in deleted state

🛠 Implementation

There have been crashes around accessing member data of the channel objects and one the possible culprits seems to be the automatic user deletion rule for the current user. User objects are shared between many objects and therefore should not be deleted like that. In addition, when an object is deleted, we should skip trying to convert these objects because the data is not present anymore (e.g. one can get a ChatMessage object with no properties being set, id is empty etc). That said, it is pretty rare since deleting data is not running often.

🧪 Manual Testing Notes

Running the demo app and doing some smoke testing which also includes logging out the current user.

☑️ Contributor Checklist

  • I have signed the Stream CLA (required)
  • This change should be manually QAed
  • Changelog is updated with client-facing changes
  • Changelog is updated with new localization keys
  • New code is covered by unit tests
  • Comparison screenshots added for visual changes
  • Affected documentation updated (docusaurus, tutorial, CMS)

…ed user objects when deleting the current user
@laevandus laevandus added 🐞 Bug An issue or PR related to a bug 🔧 WIP A PR that is Work in Progress 🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK labels Nov 19, 2024
@laevandus laevandus requested a review from a team as a code owner November 19, 2024 08:27
@Stream-SDK-Bot
Copy link
Collaborator

SDK Size

title develop branch diff status
StreamChat 6.96 MB 6.97 MB +16 KB 🟢
StreamChatUI 4.95 MB 4.95 MB 0 KB 🟢

@Stream-SDK-Bot
Copy link
Collaborator

SDK Performance

target metric benchmark branch performance status
MessageList Hitches total duration 10 ms 5.01 ms 49.9% 🔼 🟢
Duration 2.6 s 2.56 s 1.54% 🔼 🟢
Hitch time ratio 4 ms per s 1.95 ms per s 51.25% 🔼 🟢
Frame rate 75 fps 78.81 fps 5.08% 🔼 🟢
Number of hitches 1 0.4 60.0% 🔼 🟢

@Stream-SDK-Bot
Copy link
Collaborator

Stream-SDK-Bot commented Nov 19, 2024

SDK Size

title develop branch diff status
StreamChat 7.06 MB 7.06 MB +1 KB 🟢
StreamChatUI 4.96 MB 4.96 MB 0 KB 🟢

@laevandus laevandus changed the title [WIP] Fix converting deleted database objects Fix converting deleted database objects Nov 19, 2024
@laevandus laevandus removed the 🔧 WIP A PR that is Work in Progress label Nov 19, 2024
@laevandus laevandus added the 🤞 Ready For QA A PR that is Ready for QA label Nov 19, 2024
Copy link
Member

@nuno-vieira nuno-vieira left a comment

Choose a reason for hiding this comment

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

LGTM! ✅

Copy link

sonarcloud bot commented Nov 21, 2024

@laevandus laevandus added 🟢 QAed A PR that was QAed and removed 🤞 Ready For QA A PR that is Ready for QA labels Nov 21, 2024
@laevandus
Copy link
Contributor Author

QAed with @testableapple

@laevandus laevandus enabled auto-merge (squash) November 21, 2024 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 Bug An issue or PR related to a bug 🟢 QAed A PR that was QAed 🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants