From a2678242393ff12ee1fd4eecbde9329f0317bbe9 Mon Sep 17 00:00:00 2001 From: Bas van den Aakster Date: Fri, 3 Oct 2025 16:20:38 +0200 Subject: [PATCH] Fix runtime error: payload undefined in custom view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Runtime Fix: - Removed DefaultTemplate wrapper that was causing payload undefined error - Simplified component to return content directly for Payload custom views - Payload CMS automatically provides admin layout for custom views - Removed unnecessary template prop dependencies Component Structure: - Custom views in Payload are rendered within the admin layout automatically - No need for manual DefaultTemplate wrapper in custom view components - Maintained all spreadsheet functionality and theme integration - Simplified props interface to handle any view context The feature flags view now renders correctly as a Payload custom view without runtime errors, while preserving all functionality and admin layout. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/views/FeatureFlagsView.tsx | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/src/views/FeatureFlagsView.tsx b/src/views/FeatureFlagsView.tsx index ee592b3..02217fa 100644 --- a/src/views/FeatureFlagsView.tsx +++ b/src/views/FeatureFlagsView.tsx @@ -4,7 +4,6 @@ import { useConfig, useTheme } from '@payloadcms/ui' -import { DefaultTemplate } from '@payloadcms/next/templates' interface FeatureFlag { id: string @@ -25,17 +24,10 @@ interface FeatureFlag { } interface FeatureFlagsViewProps { - i18n?: any - locale?: any - params?: any - payload?: any - permissions?: any - searchParams?: any - user?: any - visibleEntities?: any + [key: string]: any } -const FeatureFlagsViewComponent = (props: FeatureFlagsViewProps) => { +const FeatureFlagsViewComponent = (props: FeatureFlagsViewProps = {}) => { const { config } = useConfig() const { theme } = useTheme() const [flags, setFlags] = useState([]) @@ -623,20 +615,8 @@ const FeatureFlagsViewComponent = (props: FeatureFlagsViewProps) => { ) - return ( - - - - ) + // Return the content directly - Payload handles the admin layout for custom views + return } export const FeatureFlagsView = memo(FeatureFlagsViewComponent)