Skip to content

MOBILE-621: Hold the IDFA set before initialize until the flag is known - #251

Merged
AndreyEmtsov merged 2 commits into
developfrom
feature/MOBILE-621-idfa-before-initialize
Nov 20, 2026
Merged

AndreyEmtsov merged 2 commits into
developfrom
feature/MOBILE-621-idfa-before-initialize

Conversation

@justSmK

@justSmK justSmK commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

https://tracker.yandex.ru/MOBILE-621

disableTrackingIds lives only in JS. A JS reload without a process restart (expo-updates reloadAsync, react-native-restart) resets it while the native SDK stays initialized, so setAdvertisingIdentifier(idfa) called before the next initialize sent the IDFA to the tracking host although the app had turned tracking ids off. Found on the acceptance stand with a deferred initialize.

Until initialize runs in the current JS context, the setter keeps the last value in JS. initialize passes null (flag on) or that value (flag off) to native before the native initialization, so a cold start reaches native in the same order as before. No native change.

Checked: jest and eslint; the first new test fails on develop, the other three were seen red on a one-line break of the line each guards.

disableTrackingIds lives only in JS. A JS reload without a process restart (expo-updates reloadAsync, react-native-restart) resets it while the native SDK stays initialized, so an IDFA set before the next initialize reached the tracking host although the app had turned tracking ids off. Found on the acceptance stand with a deferred initialize.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Consent withdrawal after a JS-only reload can leave the previous IDFA in native state until deferred initialization; clearing values must be forwarded immediately and covered by a regression test.

1 open issue
What changed in this PR

This PR defers forwarding IDFA values until the current JavaScript context knows disableTrackingIds, addressing JS-only reloads where the native SDK remains initialized.

Changes:

  • Buffers the latest identifier before initialization, then forwards it or clears it according to the tracking flag.
  • Documents deferred forwarding and adds four tests covering buffering, call order, consent withdrawal, and setters during initialization.
File Description
src/​index.tsx Adds pending-identifier handling and updates setter documentation.
src/​__tests__/​index.test.ts Adds coverage for identifier handling before and during initialization.

Review effort: Balanced

Comment thread src/index.tsx Resolved
@enotniy
enotniy self-requested a review November 20, 2026 12:09
@AndreyEmtsov
AndreyEmtsov merged commit 9f059a4 into develop Nov 20, 2026
7 checks passed
@AndreyEmtsov
AndreyEmtsov deleted the feature/MOBILE-621-idfa-before-initialize branch November 20, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants