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 (
|
return (
|
||||||
<SafeArea>
|
<SafeArea>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Match when={props.error.message.startsWith("Existing tab")}>
|
<Match when={error.message.startsWith("Existing tab")}>
|
||||||
<Title>Multiple tabs detected</Title>
|
<Title>Multiple tabs detected</Title>
|
||||||
<DefaultMain>
|
<DefaultMain>
|
||||||
<LargeHeader>Multiple tabs detected</LargeHeader>
|
<LargeHeader>Multiple tabs detected</LargeHeader>
|
||||||
<p class="bg-white/10 rounded-xl p-4 font-mono">
|
<p class="bg-white/10 rounded-xl p-4 font-mono">
|
||||||
<span class="font-bold">{props.error.name}</span>:{" "}
|
<span class="font-bold">{error.name}</span>:{" "}
|
||||||
{props.error.message}
|
{error.message}
|
||||||
</p>
|
</p>
|
||||||
<NiceP>
|
<NiceP>
|
||||||
Mutiny currently only supports use in one tab at a
|
Mutiny currently only supports use in one tab at a
|
||||||
@@ -50,13 +53,13 @@ export default function SetupErrorDisplay(props: { error: Error }) {
|
|||||||
<ErrorFooter />
|
<ErrorFooter />
|
||||||
</DefaultMain>
|
</DefaultMain>
|
||||||
</Match>
|
</Match>
|
||||||
<Match when={props.error.message.startsWith("Browser error")}>
|
<Match when={error.message.startsWith("Browser error")}>
|
||||||
<Title>Incompatible browser</Title>
|
<Title>Incompatible browser</Title>
|
||||||
<DefaultMain>
|
<DefaultMain>
|
||||||
<LargeHeader>Incompatible browser detected</LargeHeader>
|
<LargeHeader>Incompatible browser detected</LargeHeader>
|
||||||
<p class="bg-white/10 rounded-xl p-4 font-mono">
|
<p class="bg-white/10 rounded-xl p-4 font-mono">
|
||||||
<span class="font-bold">{props.error.name}</span>:{" "}
|
<span class="font-bold">{error.name}</span>:{" "}
|
||||||
{props.error.message}
|
{error.message}
|
||||||
</p>
|
</p>
|
||||||
<NiceP>
|
<NiceP>
|
||||||
Mutiny requires a modern browser that supports
|
Mutiny requires a modern browser that supports
|
||||||
@@ -86,8 +89,8 @@ export default function SetupErrorDisplay(props: { error: Error }) {
|
|||||||
<DefaultMain>
|
<DefaultMain>
|
||||||
<LargeHeader>Failed to load Mutiny</LargeHeader>
|
<LargeHeader>Failed to load Mutiny</LargeHeader>
|
||||||
<p class="bg-white/10 rounded-xl p-4 font-mono">
|
<p class="bg-white/10 rounded-xl p-4 font-mono">
|
||||||
<span class="font-bold">{props.error.name}</span>:{" "}
|
<span class="font-bold">{error.name}</span>:{" "}
|
||||||
{props.error.message}
|
{error.message}
|
||||||
</p>
|
</p>
|
||||||
<NiceP>
|
<NiceP>
|
||||||
Something went wrong while booting up Mutiny Wallet.
|
Something went wrong while booting up Mutiny Wallet.
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export default function Home() {
|
|||||||
return (
|
return (
|
||||||
<Switch fallback={<FullscreenLoader />}>
|
<Switch fallback={<FullscreenLoader />}>
|
||||||
<Match when={state.setup_error}>
|
<Match when={state.setup_error}>
|
||||||
<SetupErrorDisplay error={state.setup_error!} />
|
<SetupErrorDisplay initialError={state.setup_error!} />
|
||||||
</Match>
|
</Match>
|
||||||
<Match when={state.user_status === "approved"}>
|
<Match when={state.user_status === "approved"}>
|
||||||
<App />
|
<App />
|
||||||
|
|||||||
@@ -134,6 +134,10 @@ export const Provider: ParentComponent = (props) => {
|
|||||||
settings?: MutinyWalletSettingStrings
|
settings?: MutinyWalletSettingStrings
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
try {
|
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 });
|
setState({ wallet_loading: true });
|
||||||
const mutinyWallet = await setupMutinyWallet(settings);
|
const mutinyWallet = await setupMutinyWallet(settings);
|
||||||
// Get balance optimistically
|
// Get balance optimistically
|
||||||
|
|||||||
Reference in New Issue
Block a user