Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
4a8dbda0
Unverified
Commit
4a8dbda0
authored
Mar 10, 2022
by
Zach Pomerantz
Committed by
GitHub
Mar 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: memoize nested components (#3483)
parent
0cbb24c6
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
11 deletions
+12
-11
BrandedFooter.tsx
src/lib/components/BrandedFooter.tsx
+3
-2
SwapButton.tsx
src/lib/components/Swap/SwapButton.tsx
+3
-3
index.tsx
src/lib/components/Swap/Toolbar/index.tsx
+3
-3
index.tsx
src/lib/components/TokenSelect/index.tsx
+3
-3
No files found.
src/lib/components/BrandedFooter.tsx
View file @
4a8dbda0
...
...
@@ -2,6 +2,7 @@ import { Trans } from '@lingui/macro'
import
Row
from
'
lib/components/Row
'
import
{
Logo
}
from
'
lib/icons
'
import
styled
,
{
brand
,
ThemedText
}
from
'
lib/theme
'
import
{
memo
}
from
'
react
'
import
ExternalLink
from
'
./ExternalLink
'
...
...
@@ -24,7 +25,7 @@ const UniswapA = styled(ExternalLink)`
}
`
export
default
function
BrandedFooter
()
{
export
default
memo
(
function
BrandedFooter
()
{
return
(
<
Row
justify=
"center"
>
<
UniswapA
href=
{
`https://uniswap.org/`
}
>
...
...
@@ -37,4 +38,4 @@ export default function BrandedFooter() {
</
UniswapA
>
</
Row
>
)
}
}
)
src/lib/components/Swap/SwapButton.tsx
View file @
4a8dbda0
...
...
@@ -18,7 +18,7 @@ import { Spinner } from 'lib/icons'
import
{
displayTxHashAtom
,
Field
}
from
'
lib/state/swap
'
import
{
TransactionType
}
from
'
lib/state/transactions
'
import
{
useTheme
}
from
'
lib/theme
'
import
{
useCallback
,
useEffect
,
useMemo
,
useState
}
from
'
react
'
import
{
memo
,
useCallback
,
useEffect
,
useMemo
,
useState
}
from
'
react
'
import
invariant
from
'
tiny-invariant
'
import
{
ExplorerDataType
}
from
'
utils/getExplorerLink
'
...
...
@@ -35,7 +35,7 @@ function useIsPendingApproval(token?: Token, spender?: string): boolean {
return
Boolean
(
usePendingApproval
(
token
,
spender
))
}
export
default
function
SwapButton
({
disabled
}:
SwapButtonProps
)
{
export
default
memo
(
function
SwapButton
({
disabled
}:
SwapButtonProps
)
{
const
{
account
,
chainId
}
=
useActiveWeb3React
()
const
{
tokenColorExtraction
}
=
useTheme
()
...
...
@@ -234,4 +234,4 @@ export default function SwapButton({ disabled }: SwapButtonProps) {
)
}
</>
)
}
}
)
src/lib/components/Swap/Toolbar/index.tsx
View file @
4a8dbda0
...
...
@@ -5,7 +5,7 @@ import useActiveWeb3React from 'lib/hooks/useActiveWeb3React'
import
{
largeIconCss
}
from
'
lib/icons
'
import
{
Field
}
from
'
lib/state/swap
'
import
styled
,
{
ThemedText
}
from
'
lib/theme
'
import
{
useMemo
}
from
'
react
'
import
{
memo
,
useMemo
}
from
'
react
'
import
{
TradeState
}
from
'
state/routing/types
'
import
Row
from
'
../../Row
'
...
...
@@ -17,7 +17,7 @@ const ToolbarRow = styled(Row)`
${
largeIconCss
}
`
export
default
function
Toolbar
({
disabled
}:
{
disabled
?:
boolean
})
{
export
default
memo
(
function
Toolbar
({
disabled
}:
{
disabled
?:
boolean
})
{
const
{
chainId
}
=
useActiveWeb3React
()
const
{
trade
:
{
trade
,
state
},
...
...
@@ -78,4 +78,4 @@ export default function Toolbar({ disabled }: { disabled?: boolean }) {
</
ThemedText
.
Caption
>
</>
)
}
}
)
src/lib/components/TokenSelect/index.tsx
View file @
4a8dbda0
...
...
@@ -5,7 +5,7 @@ import { useCurrencyBalances } from 'lib/hooks/useCurrencyBalance'
import
useNativeCurrency
from
'
lib/hooks/useNativeCurrency
'
import
useTokenList
,
{
useIsTokenListLoaded
,
useQueryCurrencies
}
from
'
lib/hooks/useTokenList
'
import
styled
,
{
ThemedText
}
from
'
lib/theme
'
import
{
ElementRef
,
useCallback
,
useEffect
,
useMemo
,
useRef
,
useState
}
from
'
react
'
import
{
ElementRef
,
memo
,
useCallback
,
useEffect
,
useMemo
,
useRef
,
useState
}
from
'
react
'
import
{
currencyId
}
from
'
utils/currencyId
'
import
Column
from
'
../Column
'
...
...
@@ -123,7 +123,7 @@ interface TokenSelectProps {
onSelect
:
(
value
:
Currency
)
=>
void
}
export
default
function
TokenSelect
({
value
,
collapsed
,
disabled
,
onSelect
}:
TokenSelectProps
)
{
export
default
memo
(
function
TokenSelect
({
value
,
collapsed
,
disabled
,
onSelect
}:
TokenSelectProps
)
{
usePrefetchBalances
()
const
[
open
,
setOpen
]
=
useState
(
false
)
...
...
@@ -145,4 +145,4 @@ export default function TokenSelect({ value, collapsed, disabled, onSelect }: To
)
}
</>
)
}
}
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment