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
{{ message }}
Repository navigation
onStop callback not refreshed on componentUpdate #108
The function that I pass to on onStop changes because of changes in its internal dependency, but onStop always calls the first reference passed into .
I looked into the code and it seems to agree with my inference.
MicrophoneRecorder instance is created on componentDidMount of ReactMic Component and not on subsequent rerenders, so its not getting new onSave functions.
Surprisingly, the componentDidUpdate invokes microphoneRecorder.stopRecording(onStop), but the stopRecording function in MicrophoneRecorder does not even accept a param.
Seems like onStop was supposed to changed, but got missed somewhere in the implementation
I'm new to React learning useEffect and hook stuff, this was very confusing guys :D
I guess it's an optimization that you do, at least I had to learn more about React.
Activity
riwu commentedon Jan 19, 2021
Ran into the same issue. Spent an hour debugging why the
onStopcallback is using old values...artemov34 commentedon Mar 30, 2021
crutch
adnakate commentedon Apr 28, 2021
Facing the same issue. Spent hours on it. I don't like the solution using global variable.
HackerAIOfficial commentedon Mar 31, 2023
I'm new to React learning useEffect and hook stuff, this was very confusing guys :D
I guess it's an optimization that you do, at least I had to learn more about React.