refactor(29-01): stabilize useMixerHelper function references
- Wrap getMixer with useCallback to ensure stable reference - Prevents cascade of function recreations on every render - Dependencies: mixMode (selector value) - Uses allMixersRef.current (ref, not dependency) This stabilization is prerequisite for effective context memoization. All dependent functions (fillTrackVolumeObject, mute, faderChanged, etc.) now automatically stabilize because their getMixer dependency is stable. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
468860d54f
commit
d008fe977c
|
|
@ -125,13 +125,13 @@ const useMixerHelper = () => {
|
|||
// console.log("_XDEBUG_ useMixerHelper: allMixersRef updated", allMixersRef.current);
|
||||
}, [allMixers]);
|
||||
|
||||
const getMixer = (mixerId, mode) => {
|
||||
const getMixer = useCallback((mixerId, mode) => {
|
||||
// Only default to mixMode if mode is undefined, not if it's explicitly false
|
||||
if (mode === undefined) {
|
||||
mode = mixMode;
|
||||
}
|
||||
return allMixersRef.current[(mode ? 'M' : 'P') + mixerId];
|
||||
}
|
||||
}, [mixMode]);
|
||||
|
||||
const fillTrackVolumeObject = useCallback((mixerId, mode, currentAllMixers, broadcast = true) => {
|
||||
const mixer = getMixer(mixerId, mode, currentAllMixers);
|
||||
|
|
|
|||
Loading…
Reference in New Issue