Skip to content

Commit 92acbc8

Browse files
committed
fix: Repair to only look at parent window.
1 parent fc37fc8 commit 92acbc8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/up-provider/src/client.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,11 @@ class _UPClientProvider extends EventEmitter3<UPClientProviderEvents> {
274274
* @returns The provider if it successfully connected or throws an error.
275275
*/
276276
async function testWindow(up: Window | undefined | null, remote: UPClientProvider, options: UPClientProviderOptions): Promise<UPClientProvider> {
277-
const _up = up || (typeof window !== 'undefined' ? window : undefined)
277+
const _up = up || (typeof window !== 'undefined' ? window.parent : undefined)
278278
if (!_up) {
279279
throw new Error('No UP found')
280280
}
281+
clientLog('test window', _up, up)
281282
return new Promise<UPClientProvider>((resolve, reject) => {
282283
let timeout: number | NodeJS.Timeout = 0
283284
const channel = new MessageChannel()
@@ -342,6 +343,7 @@ async function testWindow(up: Window | undefined | null, remote: UPClientProvide
342343
async function findUP(authURL: UPWindowConfig, remote: UPClientProvider, options: UPClientProviderOptions): Promise<UPClientProvider | undefined> {
343344
const current = typeof window !== 'undefined' && window instanceof Window ? window.opener || window.parent : null
344345
if (current) {
346+
clientLog('finding', current, typeof window !== 'undefined' ? window : undefined)
345347
const up = await testWindow(current, remote, options)
346348
if (up) {
347349
return up

0 commit comments

Comments
 (0)