Skip to content

Event name collision risk in usePlaidEmitter #843

@jhajrizi

Description

@jhajrizi

Problem Description

The usePlaidEmitter hook uses a generic event name onEvent which causes collisions with other React Native SDKs using the same event name.

From React Native's documentation:

 * Currently, all native events are fired via a global `RCTDeviceEventEmitter`.
 * This means event names must be globally unique, and it means that call sites
 * can theoretically listen to `RCTDeviceEventEmitter` (although discouraged).

If another SDK in a react native app also uses onEvent, both listeners will fire when either SDK emits events, causing potentially unexpected behaviors.

Proposal

Events should be namespaced to ensure global uniqueness, i.e.

const listener = emitter.addListener('PlaidLink.onEvent', linkEventListener);

or

const listener = emitter.addListener('onPlaidEvent', linkEventListener);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions