segmentio / analytics-react-native

The hassle-free way to add analytics to your React-Native app.
https://segment.com/docs/sources/mobile/react-native/
MIT License
354 stars 181 forks source link

fix: startup flush policy should send restored events #943

Closed oscb closed 2 months ago

oscb commented 2 months ago

Problem reported that StartupFlushPolicy wouldn't send the pending upload events from the previous app launch.

Caused by concurrency: FlushPolicies get initialized before and without awaiting for storage restoration. Futhermore the Queue for upload is managed by the SegmentDestination plugin so there's no explicit way to await for that queue to be restored from the base client itself.

Solution: