@@ -75,7 +75,10 @@ export default function ExtensionPreview({
7575 undefined ,
7676 ) ;
7777
78- const [ isCompatible , setIsCompatible ] = useState < boolean | undefined > (
78+ const [ isMFCompatible , setIsMFCompatible ] = useState < boolean | undefined > (
79+ undefined ,
80+ ) ;
81+ const [ isLibCompatible , setIsLibCompatible ] = useState < boolean | undefined > (
7982 undefined ,
8083 ) ;
8184
@@ -100,21 +103,26 @@ export default function ExtensionPreview({
100103
101104 const remoteLibVersion =
102105 extension . config . libVersion === "unknown"
103- ? await getRemoteLibVersion (
104- extension . remoteOrigin ,
105- extension . config . id ,
106- extension . config . version ,
107- )
108- : extension . config . libVersion ;
106+ ? (
107+ await getRemoteLibVersion (
108+ extension . remoteOrigin ,
109+ extension . config . id ,
110+ extension . config . version ,
111+ )
112+ ) . replace ( "^" , "" )
113+ : extension . config . libVersion . replace ( "^" , "" ) ;
109114 setRemoteLibVersion ( remoteLibVersion ) ;
110115
111116 const mfCompatible = await checkCompatibility (
112117 hostMFVersion ,
113- hostLibVersion ,
114118 remoteMFVersion ,
119+ ) ;
120+ const libCompatible = await checkCompatibility (
121+ hostLibVersion ,
115122 remoteLibVersion ,
116123 ) ;
117- setIsCompatible ( mfCompatible ) ;
124+ setIsMFCompatible ( mfCompatible ) ;
125+ setIsLibCompatible ( libCompatible ) ;
118126 }
119127
120128 fetchVersions ( ) ;
@@ -175,8 +183,9 @@ export default function ExtensionPreview({
175183 < EnableCheckBox isActive = { isEnabled } onPress = { toggleExtension } />
176184 ) }
177185
178- { isCompatible !== undefined &&
179- ( ! isCompatible ? (
186+ { isMFCompatible !== undefined &&
187+ isLibCompatible !== undefined &&
188+ ( ! isMFCompatible || ! isLibCompatible ? (
180189 < Popover
181190 isOpen = { showMFVersionInfo }
182191 onOpenChange = { setShowMFVersionInfo }
@@ -196,23 +205,36 @@ export default function ExtensionPreview({
196205 setShowMFVersionInfo ( false ) ;
197206 } }
198207 >
199- < Icon name = "warning" className = "text-danger!" />
208+ { ! isMFCompatible ? (
209+ < Icon name = "warning" className = "text-danger!" />
210+ ) : (
211+ < Icon name = "warning" className = "text-warning!" />
212+ ) }
200213 </ Button >
201214 </ PopoverTrigger >
202215 < PopoverContent >
203216 < div className = "max-w-xs" >
204- < p >
205- This app is outdated and no longer a valid module
206- federation app. Please update the app to the latest
207- version. < br />
208- Host MF version: { hostMFVersion }
209- < br />
210- Host lib version: { hostLibVersion }
211- < br />
212- App MF version: { remoteMFVersion }
213- < br />
214- App lib version: { remoteLibVersion }
215- </ p >
217+ { ! isMFCompatible && (
218+ < p >
219+ This app is outdated and no longer a valid module
220+ federation app. Please update the app to the latest
221+ version. < br />
222+ Host MF version: { hostMFVersion }
223+ < br />
224+ App MF version: { remoteMFVersion }
225+ </ p >
226+ ) }
227+ { ! isLibCompatible && (
228+ < p >
229+ This app's library version is outdated and may not
230+ work correctly. Please update the app to the latest
231+ version.
232+ < br />
233+ Host lib version: { hostLibVersion }
234+ < br />
235+ App lib version: { remoteLibVersion }
236+ </ p >
237+ ) }
216238 </ div >
217239 </ PopoverContent >
218240 </ Popover >
@@ -241,9 +263,9 @@ export default function ExtensionPreview({
241263 < PopoverContent >
242264 < div className = "max-w-xs" >
243265 < p >
244- This app's module federation version (
245- { extension . mfVersion } ) matches the host version (
246- { hostMFVersion } ) . The app should work correctly.
266+ This app's module federation version ({ hostMFVersion } )
267+ and library version ( { hostLibVersion } ) match the host
268+ version . The app should work correctly.
247269 </ p >
248270 </ div >
249271 </ PopoverContent >
0 commit comments