diff --git a/next.config.js b/next.config.js index a2211e960d..d4fb7c621a 100644 --- a/next.config.js +++ b/next.config.js @@ -128,20 +128,6 @@ const SECURITY_HEADERS = [ const nextConfig = removeImports({ experimental: { esmExternals: true, - optimizePackageImports: [ - 'juice-sdk-core', - 'juice-sdk-react', - 'ethers', - 'ethers/lib/utils', - '@ethersproject/constants', - '@ethersproject/bignumber', - '@ethersproject', - 'viem', - 'viem/chains', - 'wagmi', - '@wagmi/core', - '@heroicons/react' - ], }, staticPageGenerationTimeout: 90, webpack: config => { diff --git a/src/packages/v2v3/utils/distributions.ts b/src/packages/v2v3/utils/distributions.ts index 84485de4f2..371c68a654 100644 --- a/src/packages/v2v3/utils/distributions.ts +++ b/src/packages/v2v3/utils/distributions.ts @@ -147,8 +147,8 @@ export function ensureSplitsSumTo100Percent({ return adjustedSplits } -export function roundSplitPercents({ splits }: { splits: Split[]}) { - return splits.map((split) => { +export function roundSplitPercents({ splits }: { splits: Split[] }) { + return splits.map(split => { return { ...split, percent: Math.round(split.percent), @@ -183,7 +183,7 @@ export function adjustedSplitPercents({ amount: currentAmount, distributionLimit: parseFloat(newDistributionLimit), }) - + const adjustedSplit = { beneficiary: split.beneficiary, percent: newPercent, @@ -269,5 +269,18 @@ export function distributionLimitsEqual( ) { return true } - return distributionLimit1?.eq(distributionLimit2 ?? 0) + + // get around limitation of BigNumber comparison, where one value can't be undefined + if ( + (typeof distributionLimit1 === 'undefined' && distributionLimit2) || + (typeof distributionLimit2 === 'undefined' && distributionLimit1) + ) { + return false + } + + if (distributionLimit1 && distributionLimit2) { + return distributionLimit1.eq(distributionLimit2 ?? null) + } + + return false } diff --git a/src/utils/server/pages/props.ts b/src/utils/server/pages/props.ts index 2091f122f1..8807575065 100644 --- a/src/utils/server/pages/props.ts +++ b/src/utils/server/pages/props.ts @@ -7,7 +7,7 @@ import { getProjectMetadata } from '../metadata' export interface ProjectPageProps { metadata?: ProjectMetadata projectId: number - chainName?: string + chainName?: string | null } export async function getProjectStaticProps( @@ -25,7 +25,7 @@ export async function getProjectStaticProps( props: { metadata, projectId, - chainName, + chainName: chainName ?? null, }, } // eslint-disable-next-line @typescript-eslint/no-explicit-any