Skip to content

useNotifications hook invokes multiple listeners #134

@leon-wbr

Description

@leon-wbr

It doesn't create any issues right now, but if this hook is supposed to help us work with notifications in the UI in the future, we'll have to clean it up eventually. As of right now, it seemingly will invoke multiple listeners, when it should be creating shared global listeners at most.

A better solution would perhaps be to use a shared context and invoke those in a provider rather than a hook. The hook can then expose the state, but maybe we can also just cut this down, I am not sure we need the listeners at all.

An important logic that is encapsulated here is around setting the ExpoPushToken, which isn't frictionless either because it only gets set if a user visits the settings screen. That is probably the cause of the recent issue where new devices weren't able to properly subscribe to notifications.

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