We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/BlaineHeffron/Larry'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
useUnsavedWarning.ts•480 B
import { useEffect } from "react";
/**
* Shows a browser "unsaved changes" prompt when the user tries to close or
* reload the page while `dirty` is true.
*/
export function useUnsavedWarning(dirty: boolean) {
useEffect(() => {
if (!dirty) return;
const handler = (e: BeforeUnloadEvent) => {
e.preventDefault();
};
window.addEventListener("beforeunload", handler);
return () => window.removeEventListener("beforeunload", handler);
}, [dirty]);
}