Skip to content

Commit

Permalink
fix(Multichain): memoize data for InconsistentSignerSetupWarning
Browse files Browse the repository at this point in the history
  • Loading branch information
schmanu committed Sep 23, 2024
1 parent d450f1c commit 63eb8a5
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@ export const InconsistentSignerSetupWarning = () => {
const undeployedSafes = useAppSelector(selectUndeployedSafes)
const { allMultiChainSafes } = useAllSafesGrouped()

const multiChainGroup = allMultiChainSafes?.find((account) => sameAddress(safeAddress, account.safes[0].address))
const [safeOverviews] = useSafeOverviews(multiChainGroup?.safes ?? [])
const multiChainGroupSafes = useMemo(
() => allMultiChainSafes?.find((account) => sameAddress(safeAddress, account.safes[0].address))?.safes ?? [],
[allMultiChainSafes, safeAddress],
)
const [safeOverviews] = useSafeOverviews(multiChainGroupSafes)

const safeSetups = useMemo(
() => getSafeSetups(multiChainGroup?.safes ?? [], safeOverviews ?? [], undeployedSafes),
[multiChainGroup?.safes, safeOverviews, undeployedSafes],
() => getSafeSetups(multiChainGroupSafes ?? [], safeOverviews ?? [], undeployedSafes),
[multiChainGroupSafes, safeOverviews, undeployedSafes],
)
const deviatingSetups = getDeviatingSetups(safeSetups, currentChain?.chainId)
const deviatingChainIds = deviatingSetups.map((setup) => setup?.chainId)
Expand Down

0 comments on commit 63eb8a5

Please sign in to comment.