File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,23 @@ export class TokensMeta extends AddressMap<TokenMetaData> {
5252 this . #tokenDataLoaded. clear ( ) ;
5353 }
5454
55+ public override upsert (
56+ address : string ,
57+ value : TokenMetaData | undefined ,
58+ ) : void {
59+ let v = value ;
60+ const existing = this . get ( address ) ;
61+ // update existing value with new one
62+ // is needed since some methods here augment existing values, to prevent losing this on market reload
63+ if ( existing && v ) {
64+ v = {
65+ ...existing ,
66+ ...v ,
67+ } ;
68+ }
69+ super . upsert ( address , v ) ;
70+ }
71+
5572 public symbol ( token : Address ) : string {
5673 return this . mustGet ( token ) . symbol ;
5774 }
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export class AddressMap<T> {
1818 }
1919
2020 /**
21- * Adds or updates value, undefined removes value
21+ * Adds or overwrites value, undefined removes value
2222 * @param address
2323 * @param value
2424 */
You can’t perform that action at this time.
0 commit comments