You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When Metro executes a fast-reload, the event listeners are not cleared, but the unregister functions are lost. As a result, every reload creates potentially more and more copies of the callbacks.
To Reproduce
Steps to reproduce the behavior:
Any structure that calls SoundPlayer.addEventListener and stores the unregister function. Change your code, save it. If you are using Metro, it will execute a fast-reload, which will reload the code, clearing your saved unregister functions.
Expected behavior
The behavior is expected, the API is not as needed or expected (more in "Additional Context" below).
Platform (please complete the following information):
In my case, I am developing using Android Studio on Windows 11. I do not expect this behavior to be different in any other environment where Metro is being used.
Additional context
The problem here is not one where the observed behavior is unexpected. The problem, at least as I understand it, is that there is no manual way to clear those callbacks. Compare to, for example, react-native-voice, which has the same issue, but provides a function removeAllCallbacks, that can be used to remove callbacks whose unregister functions are not know, lost, etc. It would seem that react-native-sound-player simply needs such a function.
The text was updated successfully, but these errors were encountered:
Describe the bug
When Metro executes a fast-reload, the event listeners are not cleared, but the unregister functions are lost. As a result, every reload creates potentially more and more copies of the callbacks.
To Reproduce
Steps to reproduce the behavior:
Any structure that calls SoundPlayer.addEventListener and stores the unregister function. Change your code, save it. If you are using Metro, it will execute a fast-reload, which will reload the code, clearing your saved unregister functions.
Expected behavior
The behavior is expected, the API is not as needed or expected (more in "Additional Context" below).
Platform (please complete the following information):
In my case, I am developing using Android Studio on Windows 11. I do not expect this behavior to be different in any other environment where Metro is being used.
Additional context
The problem here is not one where the observed behavior is unexpected. The problem, at least as I understand it, is that there is no manual way to clear those callbacks. Compare to, for example, react-native-voice, which has the same issue, but provides a function removeAllCallbacks, that can be used to remove callbacks whose unregister functions are not know, lost, etc. It would seem that react-native-sound-player simply needs such a function.
The text was updated successfully, but these errors were encountered: