Skip to content

Commit 504f58d

Browse files
authored
Merge pull request #634 from magiclabs/force-ctor-preload-iframe
Have the constructor preload iframe assets by default, with optional SDK flag to defer preloading
2 parents 945f375 + ef92e36 commit 504f58d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

packages/@magic-sdk/provider/src/core/sdk.ts

+2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export interface MagicSDKAdditionalConfiguration<
9595
network?: EthNetworkConfiguration;
9696
extensions?: TExt;
9797
testMode?: boolean;
98+
deferPreload?: boolean;
9899
}
99100

100101
export class SDKBase {
@@ -168,6 +169,7 @@ export class SDKBase {
168169
locale: options?.locale || 'en_US',
169170
...(SDKEnvironment.bundleId ? { bundleId: SDKEnvironment.bundleId } : {}),
170171
});
172+
if (!options?.deferPreload) this.preload();
171173
}
172174

173175
/**

packages/@magic-sdk/provider/test/spec/core/sdk/overlay.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ beforeEach(() => {
1010

1111
test('`MagicSDK.overlay` is lazy loaded', async () => {
1212
const Ctor = createMagicSDKCtor();
13-
const magic = new Ctor(TEST_API_KEY);
13+
const magic = new Ctor(TEST_API_KEY, { deferPreload: true });
1414

1515
expect((SDKBase as any).__overlays__.size).toBe(0);
1616

0 commit comments

Comments
 (0)