Skip to content

'View Full Page' Inspect Tool Gets Stuck In Login Loop #563

Description

@thehabes

It gets stuck in a login loop when clicked. This issue is actually in the interfaces component.

Suggested Fix
In magnifier-tool/index.js: drop the attachAuthentication / onProjectReady / CheckPermissions calls. The magnifier needs no project context and no auth — it operates purely on the imageElem it's handed.

New lifecycle:

connectedCallback() {
    this.render()
    this.addEventListeners()
}

disconnectedCallback() {
    this.renderCleanup.run()
    this.cleanup.run()
}

This kills the loop at the source and also makes MagnifierTool safely embeddable in any context (the workspace toolbar, Page-Viewer, future tools).

Additional Optional Fixes
components/simple-transcription/index.js:1146-1155 — don't call TPEN.login() from a postMessage handler.

#sendIdTokenToTool(targetWindow = ...) {
    const idToken = TPEN.getAuthorization()
    if (!idToken) {
        TPEN.login()   // <-- this nukes the parent window
        return
    }
    ...
}

Replace with a postMessage reply telling the tool no token is available, and let the tool decide what to do. Otherwise any future tool iframe that sends REQUEST_TPEN_ID_TOKEN while the parent's token is expired will trigger the same kind of redirect loop.

#sendIdTokenToTool(targetWindow = ...) {
    const idToken = TPEN.getAuthorization()
    if (!idToken) {
        this.#postToTool({ type: 'TPEN_ID_TOKEN_UNAVAILABLE' }, targetWindow)
        return
    }
    ...
}

https://github.com/CenterForDigitalHumanities/Page-Viewer Minor Cleanup

message-handler.js:55-57 — Page-Viewer is set up to receive REQUEST_TPEN_ID_TOKEN (a parent→tool message it would never get) rather than send it. The case is harmless but misleading. Either delete the case entirely, or replace it with a comment that Page-Viewer never sends or receives that message.

Not a bug — just dead code that sent me down the wrong trail earlier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions