fix: delay setting user.router_preference until statsig and redux initialize #7458
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
tl;dr: we're setting the user property to an incorrect value as we wait for the statsig and redux values to load into the app.
here we delay setting the user property until we are certain we have the right value, to avoid setting multiple values in a short time span. even though user properties apply to all subsequent events, this is important because we usually send unrelated events between the two user-prop-setting moments which solidifies the user prop in the shortest time frame amplitude supports, 1 hour. so our charts and metrics are broken because we're counting users in both buckets for that time frame.
see the slack thread for all the nitty gritty details.
Slack thread: https://uniswapteam.slack.com/archives/C0574KNS77S/p1697137960543169
Relevant docs: https://help.amplitude.com/hc/en-us/articles/115002380567-Overview-of-user-properties-and-event-properties-in-Amplitude
Test plan
Reproducing the error
QA (ie manual testing)