Skip to content

Commit d027088

Browse files
committed
Add noUncheckedIndexedAccess: true in dashboard tsconfig and fix all issues
1 parent 0dbb174 commit d027088

File tree

59 files changed

+377
-280
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+377
-280
lines changed

apps/dashboard/src/@/components/blocks/multi-select.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,18 @@ export const MultiSelect = forwardRef<HTMLButtonElement, MultiSelectProps>(
119119
if (filteredOptions.length >= itemsToShow) {
120120
break;
121121
}
122+
const option = options[i];
123+
if (!option) {
124+
continue;
125+
}
126+
122127
if (overrideSearchFn) {
123-
if (overrideSearchFn(options[i], searchValLowercase)) {
124-
filteredOptions.push(options[i]);
128+
if (overrideSearchFn(option, searchValLowercase)) {
129+
filteredOptions.push(option);
125130
}
126131
} else {
127-
if (options[i].label.toLowerCase().includes(searchValLowercase)) {
128-
filteredOptions.push(options[i]);
132+
if (option.label.toLowerCase().includes(searchValLowercase)) {
133+
filteredOptions.push(option);
129134
}
130135
}
131136
}

apps/dashboard/src/@/components/blocks/select-with-search.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,18 @@ export const SelectWithSearch = React.forwardRef<
6363
if (filteredOptions.length >= itemsToShow) {
6464
break;
6565
}
66+
const option = options[i];
67+
if (!option) {
68+
continue;
69+
}
6670

6771
if (overrideSearchFn) {
68-
if (overrideSearchFn(options[i], searchValLowercase)) {
69-
filteredOptions.push(options[i]);
72+
if (overrideSearchFn(option, searchValLowercase)) {
73+
filteredOptions.push(option);
7074
}
7175
} else {
72-
if (options[i].label.toLowerCase().includes(searchValLowercase)) {
73-
filteredOptions.push(options[i]);
76+
if (option.label.toLowerCase().includes(searchValLowercase)) {
77+
filteredOptions.push(option);
7478
}
7579
}
7680
}

apps/dashboard/src/@/components/ui/chart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const ChartTooltipContent = React.forwardRef<
143143
}
144144

145145
const [item] = payload;
146-
const key = `${labelKey || item.dataKey || item.name || "value"}`;
146+
const key = `${labelKey || item?.dataKey || item?.name || "value"}`;
147147
const itemConfig = getPayloadConfigFromPayload(config, item, key);
148148
const value =
149149
!labelKey && typeof label === "string"

apps/dashboard/src/@/components/ui/image-upload.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ const ImageUpload = React.forwardRef<HTMLInputElement, ImageUploadProps>(
1616
const [activeFile, setActiveFile] = React.useState<File | null>(null);
1717
const onDrop = React.useCallback(
1818
(acceptedFiles: File[]) => {
19-
setActiveFile(acceptedFiles[0]);
19+
if (acceptedFiles[0]) {
20+
setActiveFile(acceptedFiles[0]);
21+
}
2022
onUpload?.(acceptedFiles);
2123
},
2224
[onUpload],

apps/dashboard/src/@/components/ui/input-otp.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ const InputOTPSlot = React.forwardRef<
3535
React.ComponentPropsWithoutRef<"div"> & { index: number }
3636
>(({ index, className, ...props }, ref) => {
3737
const inputOTPContext = React.useContext(OTPInputContext);
38-
const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];
38+
// biome-ignore lint/style/noNonNullAssertion: <explanation>
39+
const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index]!;
3940

4041
return (
4142
<div

apps/dashboard/src/@3rdweb-sdk/react/hooks/useActivity.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,12 @@ export function useActivity(contract: ThirdwebContract, autoUpdate?: boolean) {
4444
}
4545
const obj = eventsQuery.data.slice(0, 100).reduce(
4646
(acc, curr) => {
47-
if (acc[curr.transactionHash]) {
48-
acc[curr.transactionHash].events.push(curr);
49-
acc[curr.transactionHash].events.sort(
50-
(a, b) => b.logIndex - a.logIndex,
51-
);
52-
if (acc[curr.transactionHash].blockNumber > curr.blockNumber) {
53-
acc[curr.transactionHash].blockNumber = curr.blockNumber;
47+
const internalTx = acc[curr.transactionHash];
48+
if (internalTx) {
49+
internalTx.events.push(curr);
50+
internalTx.events.sort((a, b) => b.logIndex - a.logIndex);
51+
if (internalTx.blockNumber > curr.blockNumber) {
52+
internalTx.blockNumber = curr.blockNumber;
5453
}
5554
} else {
5655
acc[curr.transactionHash] = {

apps/dashboard/src/@3rdweb-sdk/react/hooks/useDashboardContractMetadata.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export async function fetchDashboardContractMetadata(
4848
if (compilerMetadata?.name.includes(":")) {
4949
const _name = compilerMetadata.name.split(":")[1];
5050
if (_name) {
51-
compilerMetadata.name = compilerMetadata.name.split(":")[1];
51+
compilerMetadata.name = _name;
5252
}
5353
}
5454

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/embed/embed-setup.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ function minimizeChain(
171171
return {
172172
name: chain.name,
173173
chain: chain.chain,
174-
rpc: [firstRpc],
174+
rpc: [firstRpc || ""],
175175
nativeCurrency: chain.nativeCurrency,
176176
shortName: chain.shortName,
177177
chainId: chain.chainId,
@@ -509,7 +509,7 @@ export const EmbedSetup: React.FC<EmbedSetupProps> = ({
509509
)}
510510
{colorOptions.map((color) => (
511511
<option key={color} value={color}>
512-
{color[0].toUpperCase() + color.substring(1)}
512+
{color[0]?.toUpperCase() + color.substring(1)}
513513
</option>
514514
))}
515515
</Select>
@@ -524,7 +524,7 @@ export const EmbedSetup: React.FC<EmbedSetupProps> = ({
524524
<Select {...register("secondaryColor")}>
525525
{colorOptions.map((color) => (
526526
<option key={color} value={color}>
527-
{color[0].toUpperCase() + color.substring(1)}
527+
{color[0]?.toUpperCase() + color.substring(1)}
528528
</option>
529529
))}
530530
</Select>

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/PermissionsTable.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ export const PermissionsTable: React.FC<PermissionsTableProps> = ({
4141
roleMembers.forEach((member) => {
4242
return !acc.find((m) => m.member === member)
4343
? acc.push({ member, roles: [role] })
44-
: acc[acc.findIndex((m) => m.member === member)].roles.push(role);
44+
: acc[acc.findIndex((m) => m.member === member)]?.roles.push(
45+
role,
46+
);
4547
});
4648

4749
return acc;

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/split/components/distribute-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const DistributeButton: React.FC<DistributeButtonProps> = ({
3131
const numTransactions = useMemo(() => {
3232
if (
3333
validBalances.length === 1 &&
34-
validBalances[0].name === "Native Token"
34+
validBalances[0]?.name === "Native Token"
3535
) {
3636
return 1;
3737
}

0 commit comments

Comments
 (0)