Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
Address Cursor comments re hotkeys, slow transition issues
Brendan O'Leary714cca6e27b8
diff --git a/docs/app/(home)/layout.tsx b/docs/app/(home)/layout.tsxindex c0b0b789a..bd15310d6 100644--- a/docs/app/(home)/layout.tsx+++ b/docs/app/(home)/layout.tsx@@ -1,25 +1,12 @@import { HomeLayout } from 'fumadocs-ui/layouts/home';-import { headers } from 'next/headers';import { baseOptions } from '@/lib/layout.shared';import { EveChatMount } from '@/components/eve-chat-mount';-import { DocsProductProvider } from '@/components/docs-product-context';-import {- DEFAULT_DOCS_PRODUCT,- DOCS_PRODUCT_HEADER,- parseDocsProduct,-} from '@/lib/home-navigation';--export default async function Layout({ children }: LayoutProps<'/'>) {- const requestHeaders = await headers();- const initialProduct =- parseDocsProduct(requestHeaders.get(DOCS_PRODUCT_HEADER)) ?? DEFAULT_DOCS_PRODUCT;+export default function Layout({ children }: LayoutProps<'/'>) {return (- <DocsProductProvider initialProduct={initialProduct}>- <HomeLayout {...baseOptions()}>- {children}- <EveChatMount />- </HomeLayout>- </DocsProductProvider>+ <HomeLayout {...baseOptions()}>+ {children}+ <EveChatMount />+ </HomeLayout>);}diff --git a/docs/app/layout.tsx b/docs/app/layout.tsxindex bbd9955d1..ceabf9db7 100644--- a/docs/app/layout.tsx+++ b/docs/app/layout.tsx@@ -1,5 +1,6 @@import { RootProvider } from 'fumadocs-ui/provider/next';import type { Metadata } from 'next';+import { headers } from 'next/headers';import { Analytics } from '@vercel/analytics/next';import './global.css';import { JetBrains_Mono } from 'next/font/google';@@ -10,6 +11,13 @@ import { ScrollReset } from '@/components/scroll-reset';import { source, referenceSource } from '@/lib/source';import { TOOLKIT_COUNT_LABEL } from '@/lib/toolkit-count';import { ProductTransitionLoader } from '@/components/product-transition-loader';+import { DocsProductProvider } from '@/components/docs-product-context';+import {+ DEFAULT_DOCS_PRODUCT,+ DOCS_PRODUCTS,+ DOCS_PRODUCT_HEADER,+ parseDocsProduct,+} from '@/lib/home-navigation';const defaultLinkSlugs: { slug: string[]; source: typeof source }[] = [{ slug: ['quickstart'], source },@@ -66,7 +74,11 @@ const jetbrainsMono = JetBrains_Mono({display: 'swap',});-export default function Layout({ children }: LayoutProps<'/'>) {+export default async function Layout({ children }: LayoutProps<'/'>) {+ const initialProduct =+ parseDocsProduct((await headers()).get(DOCS_PRODUCT_HEADER)) ?? DEFAULT_DOCS_PRODUCT;+ const initialTheme = DOCS_PRODUCTS[initialProduct].theme;+return (<htmllang="en"@@ -74,6 +86,11 @@ export default function Layout({ children }: LayoutProps<'/'>) {suppressHydrationWarning><head>+ <script+ dangerouslySetInnerHTML={{+ __html: `try{localStorage.setItem('theme','${initialTheme}')}catch{}document.documentElement.classList.remove('light','dark');document.documentElement.classList.add('${initialTheme}');document.documentElement.style.colorScheme='${initialTheme}'`,+ }}+ /><meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)" /><meta name="theme-color" content="#131211" media="(prefers-color-scheme: dark)" /><script@@ -120,6 +137,7 @@ export default function Layout({ children }: LayoutProps<'/'>) {defaultTheme: 'system',attribute: 'class',enableSystem: true,+ hotKey: false,}}search={{SearchDialog: CustomSearchDialog,@@ -129,7 +147,7 @@ export default function Layout({ children }: LayoutProps<'/'>) {} as Record<string, unknown>,}}>- {children}+ <DocsProductProvider initialProduct={initialProduct}>{children}</DocsProductProvider></RootProvider></PostHogProvider></body>diff --git a/docs/components/docs-product-context.tsx b/docs/components/docs-product-context.tsxindex ba5c56395..4d53afb5b 100644--- a/docs/components/docs-product-context.tsx+++ b/docs/components/docs-product-context.tsx@@ -153,13 +153,7 @@ export function DocsProductProvider({return new Promise<void>(resolve => {pendingNavigation.current?.resolve();const finish = () => resolve();- window.setTimeout(() => {- if (pendingNavigation.current?.resolve === finish) {- pendingNavigation.current = null;- setPendingProduct(null);- }- finish();- }, 1500);+ window.setTimeout(finish, 1500);pendingNavigation.current = {from: pathname,resolve: finish,diff --git a/docs/tests/static/product-navigation.test.ts b/docs/tests/static/product-navigation.test.tsindex cf5953a89..06de35fc8 100644--- a/docs/tests/static/product-navigation.test.ts+++ b/docs/tests/static/product-navigation.test.ts@@ -147,6 +147,9 @@ describe('Docs product navigation', () => {const contextSource = await Bun.file(new URL('../../components/docs-product-context.tsx', import.meta.url),).text();+ const rootLayoutSource = await Bun.file(+ new URL('../../app/layout.tsx', import.meta.url),+ ).text();expect(switcherSource).toContain('aria-label={`Switch Composio product. Current product:');expect(switcherSource).toContain('ProductSelectionLink');@@ -160,5 +163,8 @@ describe('Docs product navigation', () => {expect(sharedLayoutSource).toContain('slots: { navTitle: ProductNavTitle }');expect(sharedLayoutSource).toContain('themeSwitch: { enabled: false }');expect(contextSource).toContain('setTheme(DOCS_PRODUCTS[product].theme)');+ expect(contextSource).toContain('window.setTimeout(finish, 1500)');+ expect(rootLayoutSource).toContain("localStorage.setItem('theme','${initialTheme}')");+ expect(rootLayoutSource).toContain('hotKey: false');});});