Skip to content

Commit

Permalink
Fix flicker when open inventory modal initailly (#1069)
Browse files Browse the repository at this point in the history
* Fix re-render when opening modal

* Let collection fetch fails quietly
  • Loading branch information
JunichiSugiura authored Nov 26, 2024
1 parent 1de9ad6 commit 8a8840c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 7 additions & 2 deletions packages/profile/src/components/account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ import { Navigate, Outlet, useLocation, useParams } from "react-router-dom";

export function Account() {
const location = useLocation();
const { username } = useParams<{
const { username, project } = useParams<{
username: string;
project: string;
}>();

if (location.pathname === `/account/${username}`) {
if (
[`/account/${username}`, `/account/${username}/slot/${project}`].includes(
location.pathname,
)
) {
return <Navigate to="inventory" replace />;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
useErc721BalancesQuery,
} from "@cartridge/utils/api/indexer";
import { useAccount } from "@/hooks/account";
import { LayoutContentError, LayoutContentLoader } from "@/components/layout";
import { useMemo } from "react";
import { useIndexerAPI } from "@cartridge/utils";

Expand Down Expand Up @@ -55,11 +54,9 @@ export function Collections() {
}, [data, indexerUrl]);

switch (status) {
case "loading": {
return <LayoutContentLoader />;
}
case "loading":
case "error": {
return <LayoutContentError />;
return null;
}
default: {
return (
Expand Down

0 comments on commit 8a8840c

Please sign in to comment.