A React hook that provides platform configuration data with intelligent caching to minimize API calls and offers multiple data formats for different UI components. ## Key Components - **`usePlatformConfig()`** - Main hook that fetches and caches platform configurations from `/api/config/platforms` - **`usePlatformByValue(value)`** - Helper hook to find a specific platform by its value - **`useValidatePlatform(value)`** - Helper hook to validate if a platform value exists - **`platformCache`** - Module-level cache to prevent redundant API calls across component instances - **`fetchPromise`** - Shared promise to handle concurrent requests efficiently ## Usage Example ```typescript import { usePlatformConfig, usePlatformByValue } from './hooks/use-platform-config'; function PlatformSelector() { const { platformOptions, selectableOptions, isLoading, error } = usePlatformConfig(); if (isLoading) return
Loading platforms...
; if (error) return
Error: {error.message}
; return ( ); } function PlatformDetails({ platformValue }: { platformValue: string }) { const platform = usePlatformByValue(platformValue); return platform ? (
{platform.label} - {platform.description}
) : null; } ``` The hook automatically includes an "All Platforms" option and transforms configurations into rich selectable options with icons and colors for enhanced UI components.