## Summary - `SettingsApplicationCustomTab` renders `FrontComponentRenderer` which calls `useFrontComponentExecutionContext` → `useLayoutRenderingContext()`, but the settings page never provided a `LayoutRenderingProvider` - Every other render site (side panel, command menu, record pages) wraps `FrontComponentRenderer` with this provider — it was just missed here - Opening the "Custom" tab in Settings → Applications crashes with: `LayoutRenderingContext Context not found` - Fix: wrap with `LayoutRenderingProvider` using `DASHBOARD` layout type and no target record, matching the pattern used in `SidePanelFrontComponentPage` ## Test plan - [ ] Open Settings → Applications → any app with a custom settings tab - [ ] Click the "Custom" tab — should render the front component without crashing 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Charles Bochet <charles@twenty.com>
42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
import { Suspense, lazy } from 'react';
|
|
|
|
import { useHeadlessCommandContextApi } from '@/command-menu-item/engine-command/hooks/useHeadlessCommandContextApi';
|
|
import { CommandComponentInstanceContext } from '@/command-menu-item/engine-command/states/contexts/CommandComponentInstanceContext';
|
|
import { isHeadlessFrontComponentCommandContextApi } from '@/command-menu-item/engine-command/utils/isHeadlessFrontComponentCommandContextApi';
|
|
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
|
|
|
|
const FrontComponentRenderer = lazy(() =>
|
|
import('@/front-components/components/FrontComponentRenderer').then(
|
|
(module) => ({ default: module.FrontComponentRenderer }),
|
|
),
|
|
);
|
|
|
|
export const HeadlessFrontComponentRendererEngineCommand = () => {
|
|
const commandMenuItemId = useAvailableComponentInstanceIdOrThrow(
|
|
CommandComponentInstanceContext,
|
|
);
|
|
|
|
const context = useHeadlessCommandContextApi();
|
|
|
|
if (!isHeadlessFrontComponentCommandContextApi(context)) {
|
|
throw new Error(
|
|
'Context is not a headless front component command context API',
|
|
);
|
|
}
|
|
|
|
const recordId =
|
|
context.selectedRecords.length === 1
|
|
? context.selectedRecords[0].id
|
|
: undefined;
|
|
|
|
return (
|
|
<Suspense fallback={null}>
|
|
<FrontComponentRenderer
|
|
frontComponentId={context.frontComponentId}
|
|
commandMenuItemId={commandMenuItemId}
|
|
recordId={recordId}
|
|
/>
|
|
</Suspense>
|
|
);
|
|
};
|