feat: support isolation mode tag#5600
Conversation
🦋 Changeset detectedLatest commit: bb8f6a2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR adds an "Isolated" badge to assets in isolation-mode groups within the market table and refactors the
Confidence Score: 4/5Safe to merge after fixing the hardcoded pool name in the supply description. The supplyDescription translation now hardcodes Core Pool and SupplyNotification no longer passes pool.name, but AssetWarning is rendered on every market page. Any borrowable or non-zero-collateral-factor asset in a non-Core pool will display the wrong pool name. SupplyNotification/index.tsx and en.json (plus all other locale files) need the poolName interpolation restored. Important Files Changed
Reviews (2): Last reviewed commit: "feat: support transalation" | Re-trigger Greptile |
| if (isAvailableInEMode && isAvailableInIsolation) { | ||
| // t('assetWarning.modeOnly.eModeAndIsolation') | ||
| i18nKey = 'assetWarning.modeOnly.eModeAndIsolation'; | ||
| } else if (isAvailableInEMode) { | ||
| // t('assetWarning.modeOnly.eMode') | ||
| i18nKey = 'assetWarning.modeOnly.eMode'; | ||
| } else { | ||
| // t('assetWarning.modeOnly.isolation') | ||
| i18nKey = 'assetWarning.modeOnly.isolation'; | ||
| } |
There was a problem hiding this comment.
The
else branch fires even when both isAvailableInEMode and isAvailableInIsolation are false, so an asset with collateralFactor === 0 that is not in any mode group will incorrectly display the isolation-mode-only message. Adding an explicit isAvailableInIsolation guard prevents this.
| if (isAvailableInEMode && isAvailableInIsolation) { | |
| // t('assetWarning.modeOnly.eModeAndIsolation') | |
| i18nKey = 'assetWarning.modeOnly.eModeAndIsolation'; | |
| } else if (isAvailableInEMode) { | |
| // t('assetWarning.modeOnly.eMode') | |
| i18nKey = 'assetWarning.modeOnly.eMode'; | |
| } else { | |
| // t('assetWarning.modeOnly.isolation') | |
| i18nKey = 'assetWarning.modeOnly.isolation'; | |
| } | |
| if (isAvailableInEMode && isAvailableInIsolation) { | |
| // t('assetWarning.modeOnly.eModeAndIsolation') | |
| i18nKey = 'assetWarning.modeOnly.eModeAndIsolation'; | |
| } else if (isAvailableInEMode) { | |
| // t('assetWarning.modeOnly.eMode') | |
| i18nKey = 'assetWarning.modeOnly.eMode'; | |
| } else if (isAvailableInIsolation) { | |
| // t('assetWarning.modeOnly.isolation') | |
| i18nKey = 'assetWarning.modeOnly.isolation'; | |
| } else { | |
| // Asset is not in core and not in any mode group — fall back to standard supply description | |
| return ( | |
| <Trans | |
| i18nKey="assetWarning.supplyDescription" | |
| values={{ tokenSymbol }} | |
| components={{ Button: showAllMarketsButton }} | |
| /> | |
| ); | |
| } |
| const description = | ||
| type === 'supply' && asset ? ( | ||
| <SupplyNotification asset={asset} pool={pool} onShowAllMarkets={handleShowAssets} /> | ||
| ) : ( | ||
| <Trans | ||
| // t('assetWarning.borrowDescription') | ||
| i18nKey="assetWarning.borrowDescription" | ||
| values={{ poolName: pool.name, tokenSymbol: token.symbol }} | ||
| components={{ | ||
| Button: ( | ||
| <TextButton | ||
| className="p-0 h-auto font-medium text-xs md:text-sm" | ||
| onClick={handleShowAssets} | ||
| /> | ||
| ), | ||
| }} | ||
| /> | ||
| ); |
There was a problem hiding this comment.
When
type === 'supply' but asset is not provided (e.g., the existing "renders without crashing" test), the else-branch now renders assetWarning.borrowDescription instead of the supply description. Before this PR, the supply path always rendered assetWarning.supplyDescription. Any caller that passes type="supply" without asset will silently display borrow-facing copy.
| const description = | |
| type === 'supply' && asset ? ( | |
| <SupplyNotification asset={asset} pool={pool} onShowAllMarkets={handleShowAssets} /> | |
| ) : ( | |
| <Trans | |
| // t('assetWarning.borrowDescription') | |
| i18nKey="assetWarning.borrowDescription" | |
| values={{ poolName: pool.name, tokenSymbol: token.symbol }} | |
| components={{ | |
| Button: ( | |
| <TextButton | |
| className="p-0 h-auto font-medium text-xs md:text-sm" | |
| onClick={handleShowAssets} | |
| /> | |
| ), | |
| }} | |
| /> | |
| ); | |
| const description = | |
| type === 'supply' ? ( | |
| asset ? ( | |
| <SupplyNotification asset={asset} pool={pool} onShowAllMarkets={handleShowAssets} /> | |
| ) : ( | |
| <Trans | |
| // t('assetWarning.supplyDescription') | |
| i18nKey="assetWarning.supplyDescription" | |
| values={{ poolName: pool.name, tokenSymbol: token.symbol }} | |
| components={{ | |
| Button: ( | |
| <TextButton | |
| className="p-0 h-auto font-medium text-xs md:text-sm" | |
| onClick={handleShowAssets} | |
| /> | |
| ), | |
| }} | |
| /> | |
| ) | |
| ) : ( | |
| <Trans | |
| // t('assetWarning.borrowDescription') | |
| i18nKey="assetWarning.borrowDescription" | |
| values={{ poolName: pool.name, tokenSymbol: token.symbol }} | |
| components={{ | |
| Button: ( | |
| <TextButton | |
| className="p-0 h-auto font-medium text-xs md:text-sm" | |
| onClick={handleShowAssets} | |
| /> | |
| ), | |
| }} | |
| /> | |
| ); |
|
@greptile review again |
Coverage Report for ./apps/evm
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Jira ticket(s)
VPD-1201
Changes