stream-chat-swift
stream-chat-swift copied to clipboard
Discard any changes before we delete the persistent state
๐ฏ Goal
Make sure that changed managed object contexts do not trigger adding new data in removeAllData
๐ Summary
In the state layer branch we have a case where channel was not properly deleted on logout. That branch also has additional managed object context which is aggressively merging changes from other contexts (this seems to be related).
- Log in with A
- Open channel with A and B
- Logout and log in with B
- Open channel with A and B โ issue happens (assert telling multiple ChannelDTOs for the same cid)
๐ Implementation
Reset contexts when we logout for making sure we discard any active changes and do not try to save them when later the code path calls writableContext.save
.
๐จ Showcase
From: feature/chat-state-layer
๐งช Manual Testing Notes
Follow the steps above.
โ๏ธ Contributor Checklist
- [x] I have signed the Stream CLA (required)
- [x] This change follows zero โ ๏ธ policy (required)
- [x] This change should be manually QAed
- [x] Changelog is updated with client-facing changes
- [ ] New code is covered by unit tests
- [ ] Comparison screenshots added for visual changes
- [ ] Affected documentation updated (docusaurus, tutorial, CMS)
StreamChat XCMetrics
target |
metric |
benchmark |
branch |
performance |
status |
---|---|---|---|---|---|
MessageList | Hitches total duration | 10 ms | 3.34 ms | 66.6% ๐ผ | ๐ข |
Duration | 2.6 s | 2.55 s | 1.92% ๐ผ | ๐ข | |
Hitch time ratio | 4 ms per s | 1.31 ms per s | 67.25% ๐ผ | ๐ข | |
Frame rate | 79 fps | 78.66 fps | 0.43% ๐ผ | ๐ข | |
Number of hitches | 1 | 0.4 | 60.0% ๐ผ | ๐ข | |
ChannelList | Hitches total duration | 12.5 ms | 0.0 ms | 100.0% ๐ผ | ๐ข |
Duration | 2.6 s | 0.83 s | 68.08% ๐ผ | ๐ข | |
Hitch time ratio | 5 ms per s | 0.0 ms per s | 100.0% ๐ผ | ๐ข | |
Frame rate | 76 fps | 62.81 fps | 17.36% ๐ผ | ๐ข | |
Number of hitches | 1.2 | 0.0 | 100.0% ๐ผ | ๐ข |
I will hold this one until we have released 4.53.0.
Quality Gate passed
Issues
66 New issues
0 Accepted issues
Measures
0 Security Hotspots
83.7% Coverage on New Code
0.0% Duplication on New Code