Skip to content
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

Show a nicer UI when minifront can't connect to the extension, and for other errors #752

Merged
merged 8 commits into from
Mar 14, 2024

Conversation

jessepinho
Copy link
Contributor

@jessepinho jessepinho commented Mar 13, 2024

Previously, when the RPC node was unavailable, the <ErrorBoundary /> component would catch the error, stringify it, and render it to the screen.

Now, we detect whether the given error is specific to the RPC being unavailable, and we show a message for that case.

Before

image

After

image

I also prettified the <ErrorBoundary /> in both the minifront and node-status apps to show other types of errors inside a <SplashPage /> — e.g.:

image

And lastly, I created a 404 page:
image

Closes #571
Closes #339

Base automatically changed from jessepinho/unavailable-rpc-errors-part-1-web-571 to main March 13, 2024 22:36
@jessepinho jessepinho force-pushed the jessepinho/unavailable-rpc-errors-part-2-web-571 branch 7 times, most recently from 599316e to 065eaa5 Compare March 14, 2024 20:43
@jessepinho jessepinho force-pushed the jessepinho/unavailable-rpc-errors-part-2-web-571 branch from 065eaa5 to a37a2d1 Compare March 14, 2024 20:43
@jessepinho jessepinho changed the title WIP: show RPC connect error in UI Show a nicer UI when minifront can't connect to the extension Mar 14, 2024
Comment on lines +3 to +5
export const getChainId = async (): Promise<string | undefined> => {
const { parameters } = await viewClient.appParameters({});
if (!parameters?.chainId) throw new Error('No chainId in response');

return parameters.chainId;
return parameters?.chainId;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little change @turbocrime suggested. We don't need to throw if the chain ID doesn't come back from the server.

@jessepinho jessepinho marked this pull request as ready for review March 14, 2024 21:11
@jessepinho jessepinho changed the title Show a nicer UI when minifront can't connect to the extension Show a nicer UI when minifront can't connect to the extension, and for other errors Mar 14, 2024
@jessepinho jessepinho requested review from grod220 and turbocrime and removed request for grod220 March 14, 2024 21:11
Comment on lines +4 to +5
const NODE_STATUS_PAGE_URL =
window.location.hostname === 'localhost' ? 'http://localhost:5174' : '/';
Copy link
Contributor

@turbocrime turbocrime Mar 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this probably needs a .env and webpack define

edit: i guess this is vite

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, it seems to be the same as the grpc endpoint uri

Copy link
Contributor Author

@jessepinho jessepinho Mar 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is tricky... we'd want to define the port number in .env, you mean, right? that would mean putting 5174 in node-status's .env file, and then importing it from minifront? (Cause I assume we'd also want to use the .env value in node-status's package.json dev script.)

Copy link
Contributor

@turbocrime turbocrime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps correct node_status uri but otherwise merge away

Comment on lines +12 to +26
<SplashPage title='Penumbra extension unavailble'>
<p className='mb-2'>We can&apos;t currently connect to the Penumbra extension.</p>
<p className='mb-2'>
This page may have been left open for too long, causing a timeout. Please reload this page
and see if that fixes the issue.
</p>
<p>
If it doesn&apos;t, the RPC node that you&apos;re connected to could be down. Check{' '}
<a href={NODE_STATUS_PAGE_URL} className='underline'>
the node&apos;s status page
</a>{' '}
and, if it is down, consider switching to a different RPC URL in the Penumbra
extension&apos;s settings.
</p>
</SplashPage>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these cases should be readily distinguishable by the error message

@jessepinho jessepinho merged commit 5c3f23f into main Mar 14, 2024
6 checks passed
@jessepinho jessepinho deleted the jessepinho/unavailable-rpc-errors-part-2-web-571 branch March 14, 2024 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show a more helpful UI when the RPC is unavailable Retry logic for stale extension state
2 participants