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
2227a382
Unverified
Commit
2227a382
authored
Nov 13, 2023
by
eddie
Committed by
GitHub
Nov 13, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: set current redux version to 3 (#7578)
* fix: set current redux version to 3 * fix: tests
parent
9f067479
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
4 deletions
+6
-4
migrations.test.ts
src/state/migrations.test.ts
+1
-1
migrations.ts
src/state/migrations.ts
+2
-0
3.ts
src/state/migrations/3.ts
+2
-2
reducer.ts
src/state/reducer.ts
+1
-1
No files found.
src/state/migrations.test.ts
View file @
2227a382
...
...
@@ -13,7 +13,7 @@ const defaultState = {
user
:
{},
_persist
:
{
rehydrated
:
true
,
version
:
2
,
version
:
3
,
},
application
:
{
chainId
:
null
,
...
...
src/state/migrations.ts
View file @
2227a382
...
...
@@ -4,6 +4,7 @@ import { MigrationConfig } from 'redux-persist/es/createMigrate'
import
{
migration0
}
from
'
./migrations/0
'
import
{
migration1
}
from
'
./migrations/1
'
import
{
migration2
}
from
'
./migrations/2
'
import
{
migration3
}
from
'
./migrations/3
'
import
{
legacyLocalStorageMigration
}
from
'
./migrations/legacy
'
/**
...
...
@@ -19,6 +20,7 @@ export const migrations: MigrationManifest = {
0
:
migration0
,
1
:
migration1
,
2
:
migration2
,
3
:
migration3
,
}
// We use a custom migration function for the initial state, because redux-persist
...
...
src/state/migrations/3.ts
View file @
2227a382
...
...
@@ -26,7 +26,7 @@ export const migration3 = (state: PersistAppStateV3 | undefined) => {
}
for
(
const
[
chainId
,
address
]
of
Object
.
entries
(
USDCe_ADDRESSES
))
{
const
chainIdKey
=
Number
(
chainId
)
as
ChainId
if
(
state
.
user
.
tokens
[
chainIdKey
]?.[
address
])
{
if
(
state
.
user
.
tokens
?.
[
chainIdKey
]?.[
address
])
{
state
.
user
.
tokens
[
chainIdKey
][
address
]
=
serializeToken
(
new
Token
(
chainIdKey
,
address
,
6
,
'
USDC.e
'
,
'
Bridged USDC
'
)
)
...
...
@@ -40,7 +40,7 @@ export const migration3 = (state: PersistAppStateV3 | undefined) => {
'
USDbC
'
,
'
USD Base Coin
'
)
if
(
state
.
user
.
tokens
[
ChainId
.
BASE
]?.[
USDbC_BASE
.
address
])
{
if
(
state
.
user
.
tokens
?.
[
ChainId
.
BASE
]?.[
USDbC_BASE
.
address
])
{
state
.
user
.
tokens
[
ChainId
.
BASE
][
USDbC_BASE
.
address
]
=
serializeToken
(
USDbC_BASE
)
}
return
{
...
...
src/state/reducer.ts
View file @
2227a382
...
...
@@ -44,7 +44,7 @@ export type AppState = ReturnType<typeof appReducer>
const
persistConfig
:
PersistConfig
<
AppState
>
=
{
key
:
'
interface
'
,
version
:
2
,
// see migrations.ts for more details about this version
version
:
3
,
// see migrations.ts for more details about this version
storage
:
localForage
.
createInstance
({
name
:
'
redux
'
,
}),
...
...
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