From b5d3bbdc3f30677458e2bc80d627be286a1530a3 Mon Sep 17 00:00:00 2001 From: PhilReact Date: Sat, 31 May 2025 10:07:48 +0300 Subject: [PATCH] fix primary name retrieval --- src/common/ListLoader.tsx | 4 +++- src/components/ResourceList/ResourceListDisplay.tsx | 2 +- src/hooks/useAuth.tsx | 2 +- src/index.ts | 1 + src/state/cache.ts | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/common/ListLoader.tsx b/src/common/ListLoader.tsx index 581bf8c..2776a19 100644 --- a/src/common/ListLoader.tsx +++ b/src/common/ListLoader.tsx @@ -2,13 +2,15 @@ import { Box, Typography } from "@mui/material"; import { BarSpinner } from "./Spinners/BarSpinner/BarSpinner"; import { CSSProperties } from "react"; +export type LoaderListStatus = "LOADING" | "NO_RESULTS" + interface ListLoaderProps { isLoading: boolean; loadingMessage?: string; // Optional message while loading resultsLength: number; noResultsMessage?: string; // Optional message when no results children: React.ReactNode; // Required, to render the list content - loaderList?: (status: "LOADING" | "NO_RESULTS") => React.ReactNode; // Function type + loaderList?: (status: LoaderListStatus) => React.ReactNode; // Function type loaderHeight?: CSSProperties } diff --git a/src/components/ResourceList/ResourceListDisplay.tsx b/src/components/ResourceList/ResourceListDisplay.tsx index fd8548d..f7b2997 100644 --- a/src/components/ResourceList/ResourceListDisplay.tsx +++ b/src/components/ResourceList/ResourceListDisplay.tsx @@ -505,7 +505,7 @@ export const ListItemWrapper: React.FC = ({ // Example transformation (Modify item if needed) const transformedItem = findCachedResource ? findCachedResource - : { qortalMetadata: item }; + : { qortalMetadata: item, data: null }; return <>{render(transformedItem, index)}; }; diff --git a/src/hooks/useAuth.tsx b/src/hooks/useAuth.tsx index 9a13e2d..44ffbed 100644 --- a/src/hooks/useAuth.tsx +++ b/src/hooks/useAuth.tsx @@ -63,7 +63,7 @@ const setBalance = useAuthStore((s) => s.setBalance); action: "GET_PRIMARY_NAME", address: account.address, }); - setUser({ ...account, name: nameData?.name || "" }); + setUser({ ...account, name: nameData || "" }); } } catch (error) { setErrorLoadingUser( diff --git a/src/index.ts b/src/index.ts index 138fd5d..d57c0ed 100644 --- a/src/index.ts +++ b/src/index.ts @@ -27,4 +27,5 @@ export {Resource} from './hooks/useResources' export {Service, QortalGetMetadata} from './types/interfaces/resources' export {ListItem} from './state/cache' export {SymmetricKeys} from './utils/encryption' +export {LoaderListStatus} from './common/ListLoader' diff --git a/src/state/cache.ts b/src/state/cache.ts index c14f92c..37ac510 100644 --- a/src/state/cache.ts +++ b/src/state/cache.ts @@ -32,7 +32,7 @@ export const mergeUniqueItems = (array1: QortalMetadata[], array2: QortalMetadat }; export interface ListItem { - data?: any + data: any qortalMetadata: QortalMetadata }