@@ -478,20 +478,28 @@ const CompareContent = memo(function CompareContent({
478478 ) ;
479479 const modelsError = useChatRuntimeStore ( ( state ) => state . modelsError ) ;
480480 const [ isLoraCompare , setIsLoraCompare ] = useState < boolean | null > ( null ) ;
481+ const usedInventoryFallbackRef = useRef ( false ) ;
481482
482483 // Wait for the full LoRA inventory before choosing the layout, then freeze
483484 // that choice. Generalized compare temporarily changes the global checkpoint
484485 // as it visits each pane; those later changes must never remount the layout.
485486 useEffect ( ( ) => {
486- if ( ! modelRuntimeHydrated && ! modelsError ) return ;
487- setIsLoraCompare (
488- ( current ) =>
489- current ??
490- ( modelRuntimeHydrated
491- ? getIsLoraCompareFromState ( useChatRuntimeStore . getState ( ) )
492- : false ) ,
493- ) ;
494- } , [ modelRuntimeHydrated , modelsError ] ) ;
487+ if ( modelRuntimeHydrated ) {
488+ const detected = getIsLoraCompareFromState (
489+ useChatRuntimeStore . getState ( ) ,
490+ ) ;
491+ if ( usedInventoryFallbackRef . current ) {
492+ usedInventoryFallbackRef . current = false ;
493+ setIsLoraCompare ( detected ) ;
494+ } else {
495+ setIsLoraCompare ( ( current ) => current ?? detected ) ;
496+ }
497+ return ;
498+ }
499+ if ( ! modelsError || isLoraCompare !== null ) return ;
500+ usedInventoryFallbackRef . current = true ;
501+ setIsLoraCompare ( false ) ;
502+ } , [ modelRuntimeHydrated , modelsError , isLoraCompare ] ) ;
495503
496504 if ( isLoraCompare === null ) {
497505 return < div className = "min-h-0 flex-1" aria-busy = "true" /> ;
0 commit comments