Comparing segmentio:master...bytesoverflow:master · segmentio/analytics-react-native

Commits on Aug 15, 2025

  1. fix: prevent event loss during initialization by setting isReady befo…

    …re onReady
    
    Fixed a race condition where events tracked during the onReady() processing
    were incorrectly categorized as pending and never sent to Segment.
    
    The bug occurred when:
    1. App starts tracking events before initialization
    2. During init, onReady() begins processing pending events (takes seconds)
    3. New events arrive while onReady() is still running
    4. These events check isReady (still false) and get saved as "pending"
    5. Since onReady() already ran, these new pending events are never processed
    
    The fix simply swaps two lines to set isReady=true BEFORE calling onReady(),
    ensuring any events that arrive during processing go directly to the queue.
    
    Added tests to verify the initialization order and prevent regression.
    Configuration menu

    Browse the repository at this point in the history