feat(20-01): add removeVuState function to useVuHelpers

- Add removeVuState callback to clean up vuStates entries
- Export removeVuState alongside updateVuState
- Uses functional setState for React state batching compatibility
- Maintains immutability by creating shallow copy before deletion

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Nuwan 2026-02-08 19:26:50 +05:30
parent 4f0119b259
commit 3624c09102
1 changed files with 9 additions and 0 deletions

View File

@ -103,6 +103,14 @@ export default function useVuHelpers() {
}));
}, []);
const removeVuState = useCallback((mixerId) => {
setVuStates(prev => {
const newState = { ...prev };
delete newState[mixerId];
return newState;
});
}, []);
const updateVU3 = useCallback(
(mixer, leftValue, leftClipping, rightValue, rightClipping) => {
const fqId = createQualifiedId(mixer);
@ -175,6 +183,7 @@ export default function useVuHelpers() {
// React-like components and functions
VuMeter: VuMeterComponent,
updateVuState,
removeVuState,
vuStates,
// Legacy functions for backward compatibility