Skip to content

React Native index file initializes prior to the completion of the Salesforce login flow #461

@Hemanth-M-K

Description

@Hemanth-M-K

I’ve been working with React Native’s new architecture in combination with the Salesforce Mobile SDK and noticed an interesting behavior in the development branch,

The React Native index file initialises before the Salesforce login flow completes.

Since index.js is already initialised, it executes the following call:

oauth.getAuthCredentials(
  (data) => {
    console.log("getAuthCredentials data", data);
  },
  (error) => {
    console.log("getAuthCredentials error", error);
  }
);

At this point, because the login flow hasn’t finished yet, the call falls into the error block. If I proceed with login afterward, the index file is not triggered again, so React Native is unaware that the login completed successfully.

When investigating further, I noticed a difference between the development branch and the master branch of the SDK:

In the development branch, createReactActivityDelegate uses the default React Native delegate with Fabric enabled:


override fun createReactActivityDelegate() =
    DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)

In the master branch, createReactActivityDelegate uses SalesforceReactActivityDelegate, which prevents the index file from being re-triggered after login.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions