fix(react): add missing destroy cleanups (#1096)

This commit is contained in:
rahim
2026-03-23 16:59:37 -07:00
committed by GitHub
parent 4af0f66462
commit 1792bae3b4
10 changed files with 107 additions and 37 deletions
@@ -6,6 +6,7 @@ import { useSnapshot } from '@videojs/store/react';
import type { ReactNode } from 'react';
import { useEffect, useState } from 'react';
import { useDestroy } from '../../utils/use-destroy';
import { useLatestRef } from '../../utils/use-latest-ref';
import { useSafeId } from '../../utils/use-safe-id';
import { TooltipContextProvider } from './context';
@@ -89,8 +90,7 @@ export function TooltipRoot({
}
}, [controlledOpen, tooltip]);
// Cleanup on unmount
useEffect(() => () => tooltip.destroy(), [tooltip]);
useDestroy(tooltip);
const input = useSnapshot(tooltip.input);
core.setInput(input);