@@ -3,7 +3,7 @@ import {AppRoot, ShowToastEventArgs} from "../../app/app";
3
3
import { ITransactionStatus , TokenScript } from "@tokenscript/engine-js/src/TokenScript" ;
4
4
import { ITokenCollection } from "@tokenscript/engine-js/src/tokens/ITokenCollection" ;
5
5
import { getSingleTokenMetadata } from "../util/getSingleTokenMetadata" ;
6
- import { Card } from "@tokenscript/engine-js/src/tokenScript/Card" ;
6
+ import { Card , CardType } from "@tokenscript/engine-js/src/tokenScript/Card" ;
7
7
import { handleTransactionError , showTransactionNotification } from "../util/showTransactionNotification" ;
8
8
import { getCardButtonClass } from "../util/getCardButtonClass" ;
9
9
import { ViewBinding } from "../tabbed/viewBinding" ;
@@ -111,7 +111,6 @@ export class SmartTokenStoreViewer {
111
111
this . tokenScript . on ( "TOKENS_UPDATED" , ( data ) => {
112
112
this . cardButtons = null ;
113
113
this . overflowCardButtons = null ;
114
- this . infoCard = null ;
115
114
this . loadCards ( ) ;
116
115
} , "grid" ) ;
117
116
@@ -124,15 +123,18 @@ export class SmartTokenStoreViewer {
124
123
125
124
const cardButtons : JSX . Element [ ] = [ ] ;
126
125
const overflowCardButtons : JSX . Element [ ] = [ ] ;
127
- this . infoCard = null ;
128
126
129
127
const cards = this . tokenScript . getCards ( ) . filterCards ( ) ;
130
128
131
129
for ( let [ index , card ] of cards . entries ( ) ) {
132
130
133
131
let label = card . label ;
134
132
135
- if ( card . type === "token" && ! this . infoCard ) {
133
+ if ( card . type === "token" ) {
134
+ // The card is already loaded, we only need to update other card buttons
135
+ if ( this . infoCard )
136
+ continue ;
137
+
136
138
// Show first info card
137
139
this . infoCard = card ;
138
140
if ( ! this . infoViewController ) {
@@ -145,7 +147,7 @@ export class SmartTokenStoreViewer {
145
147
}
146
148
147
149
if ( label === "Unnamed Card" )
148
- label = card . type === "token" ? "Token Info" : card . type + " Card" ;
150
+ label = ( card . type as CardType ) === "token" ? "Token Info" : card . type + " Card" ;
149
151
150
152
try {
151
153
const enabled = await card . isEnabledOrReason ( ) ;
0 commit comments