-
-
Notifications
You must be signed in to change notification settings - Fork 239
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 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. |
@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
onMetricsChanged
docs, as current one seems to be outdated💡 Motivation and Context
There are tons of repetitive & absolutely useless
Screen size changed
events in our project. Funniest thing here is that size didn't change actually. One of the reasons for that is thatdidChangeMetrics
also reacts onviewInsets
changes, 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
example
app with new Sentry project. I changed app orientation several times, then caused error and checked appeared issue in Sentry. Then i've addedTextField
to open & close keyboard, caused one more error & checked new Sentry event. In both casesScreen size changed
only when it was expected.📝 Checklist