@@ -1541,6 +1541,8 @@ public static PublishPackageViewModel FromLocalPackage(DynamoViewModel dynamoVie
15411541 /// <summary>
15421542 /// The method is used to create a PublishPackageViewModel from a Package object.
15431543 /// If retainFolderStructure is set to true, the folder structure of the package will be retained. Else, the default folder structure will be imposed.
1544+ /// TODO: This process heavily relies on the pkg.json of the locally installed package providing all of the header-related inforamtion
1545+ /// This leads to potential mismatch from the local package and the current package on the server
15441546 /// </summary>
15451547 /// <param name="dynamoViewModel"></param>
15461548 /// <param name="pkg">The package to be loaded</param>
@@ -1573,6 +1575,16 @@ internal static PublishPackageViewModel FromLocalPackage(DynamoViewModel dynamoV
15731575 }
15741576 }
15751577
1578+ // We need to get the compatibility matrix from the cached package list
1579+ // in order to show the correct compatibility matrix in the UI.
1580+ // We are still running the risk of having a higher version of the local package
1581+ // leading to a null result for the compatibility matrix.
1582+ var cachedPackage = dynamoViewModel . PackageManagerClientViewModel . CachedPackageList
1583+ . FirstOrDefault ( x => x . Name == pkg . Name ) ;
1584+ var version = cachedPackage ? . Header . versions
1585+ . FirstOrDefault ( v => v . version . Equals ( pkg . VersionName ) ) ;
1586+ var compatibility_matrix = version ? . compatibility_matrix ;
1587+
15761588 var pkgViewModel = new PublishPackageViewModel ( dynamoViewModel )
15771589 {
15781590 Group = pkg . Group ,
@@ -1592,7 +1604,7 @@ internal static PublishPackageViewModel FromLocalPackage(DynamoViewModel dynamoV
15921604 CurrentPackageRootDirectories = new List < string > { pkg . RootDirectory } ,
15931605 //default retain folder structure to true when publishing a new version from local.
15941606 RetainFolderStructureOverride = retainFolderStructure ,
1595- CompatibilityMatrix = pkg . Header . compatibility_matrix ?
1607+ CompatibilityMatrix = compatibility_matrix ?
15961608 . Select ( entry => new PackageCompatibility (
15971609 entry . name ,
15981610 entry . versions != null ? new List < string > ( entry . versions ) : null ,
0 commit comments