@@ -634,15 +634,18 @@ const getLanguage = (cacheConfig: Required<CacheConfig>) =>
634634
635635const getConfig = ( cacheConfig : Required < CacheConfig > ) =>
636636 cache ( async ( domainKey : string ) => {
637- // Check in-memory cache first
638- const cacheKey = cacheConfig . cacheKeySuffix
639- ? `${ domainKey } :config:${ cacheConfig . cacheKeySuffix } `
640- : `${ domainKey } :config` ;
641- const inMemoryCached =
642- getFromInMemoryCache < Omit < DocsV1Read . DocsDefinition [ "config" ] , "navigation" | "root" > > ( cacheKey ) ;
643- if ( inMemoryCached != null ) {
644- console . debug ( `[getConfig] in-memory cache hit for ${ domainKey } ` ) ;
645- return inMemoryCached ;
637+ // Skip in-memory cache in local development to ensure fresh CSS/config on hot reload
638+ if ( ! isLocal ( ) ) {
639+ // Check in-memory cache first
640+ const cacheKey = cacheConfig . cacheKeySuffix
641+ ? `${ domainKey } :config:${ cacheConfig . cacheKeySuffix } `
642+ : `${ domainKey } :config` ;
643+ const inMemoryCached =
644+ getFromInMemoryCache < Omit < DocsV1Read . DocsDefinition [ "config" ] , "navigation" | "root" > > ( cacheKey ) ;
645+ if ( inMemoryCached != null ) {
646+ console . debug ( `[getConfig] in-memory cache hit for ${ domainKey } ` ) ;
647+ return inMemoryCached ;
648+ }
646649 }
647650
648651 try {
@@ -652,8 +655,13 @@ const getConfig = (cacheConfig: Required<CacheConfig>) =>
652655 cacheConfig . cacheKeySuffix
653656 ) ;
654657 if ( cached != null ) {
655- // Store in in-memory cache for future requests
656- setInMemoryCache ( cacheKey , cached ) ;
658+ // Store in in-memory cache for future requests (skip in local dev)
659+ if ( ! isLocal ( ) ) {
660+ const cacheKey = cacheConfig . cacheKeySuffix
661+ ? `${ domainKey } :config:${ cacheConfig . cacheKeySuffix } `
662+ : `${ domainKey } :config` ;
663+ setInMemoryCache ( cacheKey , cached ) ;
664+ }
657665 return cached ;
658666 }
659667 } catch ( error ) {
@@ -663,9 +671,14 @@ const getConfig = (cacheConfig: Required<CacheConfig>) =>
663671 const response = await loadWithUrl ( domainKey ) ;
664672 const { navigation, root, ...config } = response . definition . config ;
665673
666- // Store in both Upstash and in-memory cache
674+ // Store in Upstash and in-memory cache (skip in-memory in local dev)
667675 kvSet ( domainKey , CACHE_KEY_CONFIG , config , cacheConfig . kvTtl , cacheConfig . cacheKeySuffix ) ;
668- setInMemoryCache ( cacheKey , config ) ;
676+ if ( ! isLocal ( ) ) {
677+ const cacheKey = cacheConfig . cacheKeySuffix
678+ ? `${ domainKey } :config:${ cacheConfig . cacheKeySuffix } `
679+ : `${ domainKey } :config` ;
680+ setInMemoryCache ( cacheKey , config ) ;
681+ }
669682
670683 return config ;
671684 } ) ;
0 commit comments