Skip to content

Commit 82225de

Browse files
committed
feat: Add URL flag to bypass client-side cache (registry & token discovery)
1 parent d64d158 commit 82225de

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

javascript/engine-js/src/Engine.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ export class TokenScriptEngine {
128128
* Create a new TokenScript instance from a repo source
129129
* @param sourceId The unique identifier for the TokenScript file
130130
* @param viewBinding The view binding implementation to be used for this TokenScript
131-
* @param forceRefresh Bypass cache and re-resolve the TokenScript XML
131+
* @param forceRefresh Bypass resolver cache and re-resolve this contracts TokenScripts
132132
*/
133-
public async getTokenScript(sourceId: string, viewBinding?: IViewBinding, forceRefresh?: true){
133+
public async getTokenScript(sourceId: string, viewBinding?: IViewBinding, forceRefresh = false){
134134

135135
const resolveResult = await this.repo.getTokenScript(sourceId, forceRefresh);
136136

javascript/tokenscript-viewer/src/components/app/app.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,17 @@ export class AppRoot {
7575

7676
walletSelector: HTMLWalletSelectorElement;
7777

78-
discoveryAdapter: ITokenDiscoveryAdapter = new DiscoveryAdapter()
78+
private params = new URLSearchParams(document.location.search);
79+
private viewerType: ViewerTypes = initViewerType(this.params);
80+
81+
discoveryAdapter: ITokenDiscoveryAdapter = new DiscoveryAdapter(!this.params.has("___bypassCache"))
7982
attestationStorageAdapter = new AttestationStorageAdapter();
8083
tsLocalStorageAdapter = new LocalStorageAdapter();
8184

8285
private iframeProvider: ethers.BrowserProvider;
8386

8487
private confirmTxPopover: HTMLConfirmTxPopoverElement;
8588

86-
private params = new URLSearchParams(document.location.search);
87-
private viewerType: ViewerTypes = initViewerType(this.params);
88-
8989
public readonly tsEngine: TokenScriptEngine;
9090

9191
constructor() {
@@ -99,7 +99,7 @@ export class AppRoot {
9999
() => this.attestationStorageAdapter,
100100
() => this.tsLocalStorageAdapter,
101101
{
102-
noLocalStorage: this.viewerType === "opensea",
102+
noLocalStorage: this.viewerType === "opensea" || this.params.has("___bypassCache"),
103103
trustedKeys: [
104104
{
105105
issuerName: "Smart Token Labs",

0 commit comments

Comments
 (0)