mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2025-12-19 07:14:22 +01:00
fix setup error precendence
This commit is contained in:
@@ -28,17 +28,20 @@ function ErrorFooter() {
|
||||
);
|
||||
}
|
||||
|
||||
export default function SetupErrorDisplay(props: { error: Error }) {
|
||||
export default function SetupErrorDisplay(props: { initialError: Error }) {
|
||||
// Error shouldn't be reactive, so we assign to it so it just gets rendered with the first value
|
||||
const error = props.initialError;
|
||||
|
||||
return (
|
||||
<SafeArea>
|
||||
<Switch>
|
||||
<Match when={props.error.message.startsWith("Existing tab")}>
|
||||
<Match when={error.message.startsWith("Existing tab")}>
|
||||
<Title>Multiple tabs detected</Title>
|
||||
<DefaultMain>
|
||||
<LargeHeader>Multiple tabs detected</LargeHeader>
|
||||
<p class="bg-white/10 rounded-xl p-4 font-mono">
|
||||
<span class="font-bold">{props.error.name}</span>:{" "}
|
||||
{props.error.message}
|
||||
<span class="font-bold">{error.name}</span>:{" "}
|
||||
{error.message}
|
||||
</p>
|
||||
<NiceP>
|
||||
Mutiny currently only supports use in one tab at a
|
||||
@@ -50,13 +53,13 @@ export default function SetupErrorDisplay(props: { error: Error }) {
|
||||
<ErrorFooter />
|
||||
</DefaultMain>
|
||||
</Match>
|
||||
<Match when={props.error.message.startsWith("Browser error")}>
|
||||
<Match when={error.message.startsWith("Browser error")}>
|
||||
<Title>Incompatible browser</Title>
|
||||
<DefaultMain>
|
||||
<LargeHeader>Incompatible browser detected</LargeHeader>
|
||||
<p class="bg-white/10 rounded-xl p-4 font-mono">
|
||||
<span class="font-bold">{props.error.name}</span>:{" "}
|
||||
{props.error.message}
|
||||
<span class="font-bold">{error.name}</span>:{" "}
|
||||
{error.message}
|
||||
</p>
|
||||
<NiceP>
|
||||
Mutiny requires a modern browser that supports
|
||||
@@ -86,8 +89,8 @@ export default function SetupErrorDisplay(props: { error: Error }) {
|
||||
<DefaultMain>
|
||||
<LargeHeader>Failed to load Mutiny</LargeHeader>
|
||||
<p class="bg-white/10 rounded-xl p-4 font-mono">
|
||||
<span class="font-bold">{props.error.name}</span>:{" "}
|
||||
{props.error.message}
|
||||
<span class="font-bold">{error.name}</span>:{" "}
|
||||
{error.message}
|
||||
</p>
|
||||
<NiceP>
|
||||
Something went wrong while booting up Mutiny Wallet.
|
||||
|
||||
@@ -12,7 +12,7 @@ export default function Home() {
|
||||
return (
|
||||
<Switch fallback={<FullscreenLoader />}>
|
||||
<Match when={state.setup_error}>
|
||||
<SetupErrorDisplay error={state.setup_error!} />
|
||||
<SetupErrorDisplay initialError={state.setup_error!} />
|
||||
</Match>
|
||||
<Match when={state.user_status === "approved"}>
|
||||
<App />
|
||||
|
||||
@@ -134,6 +134,10 @@ export const Provider: ParentComponent = (props) => {
|
||||
settings?: MutinyWalletSettingStrings
|
||||
): Promise<void> {
|
||||
try {
|
||||
// If we're already in an error state there should be no reason to continue
|
||||
if (state.setup_error) {
|
||||
throw state.setup_error;
|
||||
}
|
||||
setState({ wallet_loading: true });
|
||||
const mutinyWallet = await setupMutinyWallet(settings);
|
||||
// Get balance optimistically
|
||||
|
||||
Reference in New Issue
Block a user