chore: only fire RatesReceived once#9298
Conversation
There was a problem hiding this comment.
I'm wondering if we also want to avoid that QuotesReceived spamming, it's sending multiple times at initial load:
Then 3 times after confirm (might due to some strict mode but 3 times seems more than the usual double rendering:

Rate event seems sane now, received one log at first input filling time
Then changing the input sent another event after fetching rates
One weird thing is that if you go back to the rate screen, it sends the event 2 times, obviously because of the strict mode but we are showing the exact same rate as before, so we will send an event for rates we already fetched in the past
Unrelated to this PR but, do you feel like we should try to avoid sending this event when going back to the rate view?
This one looks good to go!
| useEffect(() => { | ||
| if (isAnyTradeQuoteLoading) return | ||
| if (mixpanel && sortedTradeQuotes.length) { | ||
| if (!mixpanel || !sortedTradeQuotes.length) return |
@NeOMakinG good find, we definitely should! I'll make a note for a follow-up. Edit, follow-up: #9311 |


Description
Only fire the
RatesReceivedMixPanel event once for a certain trade input.Reporting-wise we don't want to clog the data with refreshes.
Issue (if applicable)
Closes #9297
Risk
Low
None
Testing
Engineering
Stick a debugger on
mixpanel.track(MixPanelEvent.RatesReceived, quoteData)and confirm it fires only once for a rate input.Operations
Nothing required.
Screenshots (if applicable)
N/A