-
Notifications
You must be signed in to change notification settings - Fork 498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(web): appUrl query was getting lost while switching network in safeApp #5081
base: dev
Are you sure you want to change the base?
Changes from 2 commits
33480b4
8211879
c288de4
16232ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import type { NextPage } from 'next' | ||
import { useRouter } from 'next/router' | ||
import { useCallback } from 'react' | ||
import { Box, CircularProgress } from '@mui/material' | ||
import { Box, CircularProgress, Typography } from '@mui/material' | ||
|
||
import { useSafeAppUrl } from '@/hooks/safe-apps/useSafeAppUrl' | ||
import { useSafeApps } from '@/hooks/safe-apps/useSafeApps' | ||
|
@@ -88,6 +88,32 @@ const SafeApps: NextPage = () => { | |
) | ||
} | ||
|
||
if (!remoteSafeAppsLoading && !isLoading && safeApp.chainIds.length === 0) { | ||
setTimeout(() => { | ||
router.push({ | ||
pathname: AppRoutes.apps.index, | ||
query: { safe: router.query.safe }, | ||
}) | ||
}, 3000) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be done in a useEffect. |
||
return ( | ||
<Box | ||
display="flex" | ||
flexDirection="column" | ||
alignItems="center" | ||
justifyContent="center" | ||
height="100%" | ||
textAlign="center" | ||
p={2} | ||
> | ||
<Typography variant="body1" gutterBottom> | ||
Chain {chainId} is not supported in this app. <br /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we display chainName here? It can be taken from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure let me just do that instead! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated fix:
check it out here: c288de4 |
||
Redirecting to home page | ||
</Typography> | ||
<CircularProgress /> | ||
</Box> | ||
) | ||
} | ||
|
||
return ( | ||
<SafeAppsErrorBoundary render={() => <SafeAppsLoadError onBackToApps={() => router.back()} />}> | ||
<AppFrame appUrl={appUrl} allowedFeaturesList={getAllowedFeaturesList(origin)} safeAppFromManifest={safeApp} /> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This preserves the query indeed but ignores the fact that a Safe App might be not enabled on all chains.
From the original issue requirements:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was thinking the same. However, in the case of other EOAs, when we switch to a different network within an app, it's the app that indicates it as an unsupported network.
Since we're displaying the app within Safe's dashboard, I guess it's a better user experience for Safe to indicate an unsupported network. Working on this fix !!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the unsupported chain handling logic in
apps/web/src/pages/apps/open.tsx
:In this commit 8211879
Key Modifications:
safeApp.chainIds
is emptyremoteSafeAppsLoading
is false before we check for chainIdsVideo Preview
Screen.Recording.2025-02-23.at.10.11.45.PM.mov
Let me know if any thing else needs to be updated @katspaugh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea!