1+ import { until } from '@vueuse/core'
12import { uniqBy } from 'es-toolkit/compat'
23import { computed , getCurrentInstance , onUnmounted , readonly , ref } from 'vue'
34
@@ -78,9 +79,8 @@ export function useConflictDetection() {
7879 try {
7980 // Get system stats from store (primary source of system information)
8081 const systemStatsStore = useSystemStatsStore ( )
81- if ( ! systemStatsStore . systemStats ) {
82- await systemStatsStore . fetchSystemStats ( )
83- }
82+ // Wait for systemStats to be initialized if not already
83+ await until ( systemStatsStore . isInitialized )
8484
8585 // Fetch version information from backend (with error resilience)
8686 const [ frontendVersion ] = await Promise . allSettled ( [
@@ -127,7 +127,7 @@ export function useConflictDetection() {
127127 }
128128
129129 systemEnvironment . value = environment
130- console . log (
130+ console . debug (
131131 '[ConflictDetection] System environment detection completed:' ,
132132 environment
133133 )
@@ -427,7 +427,7 @@ export function useConflictDetection() {
427427 Object . entries ( bulkResult ) . forEach ( ( [ packageId , failInfo ] ) => {
428428 if ( failInfo !== null ) {
429429 importFailures [ packageId ] = failInfo
430- console . log (
430+ console . debug (
431431 `[ConflictDetection] Import failure found for ${ packageId } :` ,
432432 failInfo
433433 )
@@ -500,7 +500,7 @@ export function useConflictDetection() {
500500 */
501501 async function performConflictDetection ( ) : Promise < ConflictDetectionResponse > {
502502 if ( isDetecting . value ) {
503- console . log ( '[ConflictDetection] Already detecting, skipping' )
503+ console . debug ( '[ConflictDetection] Already detecting, skipping' )
504504 return {
505505 success : false ,
506506 error_message : 'Already detecting conflicts' ,
@@ -556,7 +556,10 @@ export function useConflictDetection() {
556556 detectionSummary . value = summary
557557 lastDetectionTime . value = new Date ( ) . toISOString ( )
558558
559- console . log ( '[ConflictDetection] Conflict detection completed:' , summary )
559+ console . debug (
560+ '[ConflictDetection] Conflict detection completed:' ,
561+ summary
562+ )
560563
561564 // Store conflict results for later UI display
562565 // Dialog will be shown based on specific events, not on app mount
@@ -568,7 +571,7 @@ export function useConflictDetection() {
568571 // Merge conflicts for packages with the same name
569572 const mergedConflicts = mergeConflictsByPackageName ( conflictedResults )
570573
571- console . log (
574+ console . debug (
572575 '[ConflictDetection] Conflicts detected (stored for UI):' ,
573576 mergedConflicts
574577 )
@@ -632,11 +635,22 @@ export function useConflictDetection() {
632635 /**
633636 * Error-resilient initialization (called on app mount).
634637 * Async function that doesn't block UI setup.
635- * Ensures proper order: installed -> system_stats -> versions bulk -> import_fail_info_bulk
638+ * Ensures proper order: system_stats -> manager state -> installed -> versions bulk -> import_fail_info_bulk
636639 */
637640 async function initializeConflictDetection ( ) : Promise < void > {
638641 try {
639- // Simply perform conflict detection
642+ // Check if manager is new Manager before proceeding
643+ const { useManagerState } = await import ( '@/composables/useManagerState' )
644+ const managerState = useManagerState ( )
645+
646+ if ( ! managerState . isNewManagerUI . value ) {
647+ console . debug (
648+ '[ConflictDetection] Manager is not new Manager, skipping conflict detection'
649+ )
650+ return
651+ }
652+
653+ // Manager is new Manager, perform conflict detection
640654 // The useInstalledPacks will handle fetching installed list if needed
641655 await performConflictDetection ( )
642656 } catch ( error ) {
@@ -671,13 +685,13 @@ export function useConflictDetection() {
671685 * Check if conflicts should trigger modal display after "What's New" dismissal
672686 */
673687 async function shouldShowConflictModalAfterUpdate ( ) : Promise < boolean > {
674- console . log (
688+ console . debug (
675689 '[ConflictDetection] Checking if conflict modal should show after update...'
676690 )
677691
678692 // Ensure conflict detection has run
679693 if ( detectionResults . value . length === 0 ) {
680- console . log (
694+ console . debug (
681695 '[ConflictDetection] No detection results, running conflict detection...'
682696 )
683697 await performConflictDetection ( )
@@ -689,7 +703,7 @@ export function useConflictDetection() {
689703 const hasActualConflicts = hasConflicts . value
690704 const canShowModal = acknowledgment . shouldShowConflictModal . value
691705
692- console . log ( '[ConflictDetection] Modal check:' , {
706+ console . debug ( '[ConflictDetection] Modal check:' , {
693707 hasConflicts : hasActualConflicts ,
694708 canShowModal : canShowModal ,
695709 conflictedPackagesCount : conflictedPackages . value . length
0 commit comments