-
Notifications
You must be signed in to change notification settings - Fork 988
Description
Operating System
Windows 11
Environment (if applicable)
Chrome 142.0.7444.163
Firebase SDK Version
12.5.0
Firebase SDK Product(s)
Messaging
Project Tooling
Vue web app / PWA
Detailed Problem Description
This may not be the correct category for this request, but I wanted to open a discussion in the correct place before filing a PR. I implemented a small change to improve the usage of deleteToken(), but while preparing a pull request, I saw the notice that public API changes are currently not being accepted. The notice recommended opening an issue instead, so here it is.
When using FCM with a custom service worker, deleteToken() can only be called reliably in the same session where getToken() was invoked. If getToken() is called, and then after a page reload or later session deleteToken() is called, the operation fails. The behavior is described in detail here and noted as a feature request:
#8621
The above issue provides workaround, and it does work, but it is not very discoverable, and it’s easy for developers using custom service workers to run into this issue. Especially since older versions of the SDK exposed messaging.useServiceWorker(...), which made the dependency more clear. Today, only getToken() accepts a serviceWorkerRegistration, so it’s not obvious that deleteToken() implicitly depends on the same registration context.
To explore a potential improvement, I created a small change that adds an optional serviceWorkerRegistration parameter to deleteToken(), mirroring the existing pattern in getToken(). This change is backwards compatable as the new options are optional. I have a local PR in my fork if needed for reference:
HillBryan#2
Is there an estimated timeline for when changes to the public APIs will be open for review?
Thank you!
Steps and code to reproduce issue
Same as description