Fix duplicative Screen size changed breadcrumbs#888
Conversation
|
This sounds like potential fix for a variant of this issue #400 |
|
I understand that |
|
@marandaneto I'm not sure that debouncing is right solution here. It's also incorrect, that each time client sends event to Sentry means that framework reports about screen size change. However, i agree, that variable + |
|
@marandaneto @brustolin I've refactored this to use stream controller with |
|
@lavinov-mercury thanks, I'll review it early next week. |
Screen size changed breadcrumbs
|
@lavinov-mercury missing changelog entry. |
|
@marandaneto I've updated changelog, could you please check, if it's done right? |
All good, thanks. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #888 +/- ##
=======================================
Coverage 89.81% 89.81%
=======================================
Files 104 104
Lines 3211 3211
=======================================
Hits 2884 2884
Misses 327 327 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@marandaneto Hi! It failed to merge as branch became outdated again, could you please start workflows? |
📜 Description
This PR adds private var to save last sent metrics breadcrumb & prevent sending new breadcrumbs if data didn't change.
I'm not sure if mutable var is fine here, however, it works & passes all tests (including new ones). Any proposals on better ways to implement this are welcome 😄
I've also updated link to
onMetricsChangeddocs, as current one seems to be outdated💡 Motivation and Context
There are tons of repetitive & absolutely useless
Screen size changedevents in our project. Funniest thing here is that size didn't change actually. One of the reasons for that is thatdidChangeMetricsalso reacts onviewInsetschanges, which means that it fires on keyboard opening and closing. And it's 30+ events on my iOS device for each keyboard appearance. So, it would be nice to add new breadcrumbs only when reporting values really changes.💚 How did you test it?
I've changed related test & added new ones, checked that tests are still passing. Also i've checked it with the
exampleapp with new Sentry project. I changed app orientation several times, then caused error and checked appeared issue in Sentry. Then i've addedTextFieldto open & close keyboard, caused one more error & checked new Sentry event. In both casesScreen size changedonly when it was expected.📝 Checklist