Initial commit

This commit is contained in:
Olivier Chafik 2025-11-21 11:56:27 +00:00
commit 92f42cf533
No known key found for this signature in database

20
react/useAutoResize.ts Normal file
View file

@ -0,0 +1,20 @@
import { useEffect, RefObject } from "react";
import { App } from "../app";
/**
* Custom hook that automatically reports size changes to the parent window.
*
* @param client - MCP UI client for sending size notifications
*/
export function useAutoResize(
app: App | null,
elementRef?: RefObject<HTMLElement | null>,
) {
useEffect(() => {
if (!app) {
return;
}
return app.setupSizeChangeNotifications();
}, [app, elementRef]);
}