Skip to content

Commit

Permalink
Fix console errors (#894)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregnazario authored Nov 6, 2024
1 parent 0d96a25 commit 68ebcc5
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/components/Table/GeneralTableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default function GeneralTableRow({
},
};

// Note: This will give validateDOMNesting errors, but still work correctly
if (to) {
return <TableRow component={Link} to={to} sx={sx} {...props} />;
}
Expand Down
7 changes: 4 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import ReactDOM from "react-dom";
import {createRoot} from "react-dom/client";
import {BrowserRouter} from "react-router-dom";
import {QueryClient, QueryClientProvider} from "@tanstack/react-query";
import ExplorerRoutes from "./ExplorerRoutes";
Expand Down Expand Up @@ -51,7 +51,9 @@ declare global {

const queryClient = new QueryClient();

ReactDOM.render(
const container = document.getElementById("root");
const root = createRoot(container!);
root.render(
<React.StrictMode>
<StatsigProvider
sdkKey={
Expand All @@ -71,5 +73,4 @@ ReactDOM.render(
</QueryClientProvider>
</StatsigProvider>
</React.StrictMode>,
document.getElementById("root"),
);
10 changes: 3 additions & 7 deletions src/pages/Blocks/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ type BlockCellProps = {
function BlockHeightCell({block}: BlockCellProps) {
return (
<GeneralTableCell sx={{textAlign: "left"}}>
<Link
to={`/block/${block.block_height}`}
target="_blank"
underline="none"
>
<Link to={`/block/${block.block_height}`} underline="none">
{block.block_height}
</Link>
</GeneralTableCell>
Expand All @@ -56,7 +52,7 @@ function BlockHashCell({block}: BlockCellProps) {
function FirstVersionCell({block}: BlockCellProps) {
return (
<GeneralTableCell sx={{textAlign: "right"}}>
<Link to={`/txn/${block.first_version}`} target="_blank" underline="none">
<Link to={`/txn/${block.first_version}`} underline="none">
{block.first_version}
</Link>
</GeneralTableCell>
Expand All @@ -66,7 +62,7 @@ function FirstVersionCell({block}: BlockCellProps) {
function LastVersionCell({block}: BlockCellProps) {
return (
<GeneralTableCell sx={{textAlign: "right"}}>
<Link to={`/txn/${block.last_version}`} target="_blank" underline="none">
<Link to={`/txn/${block.last_version}`} underline="none">
{block.last_version}
</Link>
</GeneralTableCell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function TransactionTypeTooltip() {
<TableTooltip title="Transaction Types">
<Stack spacing={2}>
{Object.values(TransactionTypeName).map((type) => (
<TooltipTransactionType type={type} />
<TooltipTransactionType type={type} key={`ttt-${type}`} />
))}
</Stack>
</TableTooltip>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Transactions/TransactionsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function TransactionReceiverOrCounterPartyCell({
return (
<GeneralTableCell>
{counterparty && (
<Typography
<Box
sx={{display: "flex", fontSize: "inherit", alignItems: "row", gap: 1}}
>
{counterparty.role === "smartContract" ? (
Expand All @@ -128,7 +128,7 @@ function TransactionReceiverOrCounterPartyCell({
<span>
<HashButton hash={counterparty.address} type={HashType.ACCOUNT} />
</span>
</Typography>
</Box>
)}
</GeneralTableCell>
);
Expand Down
5 changes: 4 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,15 @@ export const standardizeAddress = (address: AccountAddressInput): string => {

export const tryStandardizeAddress = (
address: AccountAddressInput | null | undefined,
logError?: boolean,
): string | undefined => {
if (address) {
try {
return standardizeAddress(address);
} catch (e) {
console.log("Failed to standardize address", address, e);
if (logError) {
console.log("Failed to standardize address", address, e);
}
return undefined;
}
}
Expand Down

0 comments on commit 68ebcc5

Please sign in to comment.