debanjandhar12 / logseq-chatgpt-plugin

A tightly integrated ChatGPT plugin for Logseq.
GNU Affero General Public License v3.0
107 stars 10 forks source link

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'style') at AskChatGPTHandler.ts:60:20 #16

Open Chernfalin opened 1 year ago

Chernfalin commented 1 year ago

After using for a while, the "ask chatgpt" button disappeared with the following error message: "Uncaught (in promise) TypeError: Cannot read properties of null (reading 'style') at AskChatGPTHandler.ts:60:20".

// Show button if current page is a ChatGPT page only
            const page = await logseq.Editor.getCurrentPage();
            if (!(page.originalName && (page.properties?.type == "ChatGPT" || page.properties?.type == "[[ChatGPT]]"))) {
                button.style.display = "none";
                window.parent.document.getElementById("main-content-container").removeEventListener("scroll", window.parent.scrollFixForChatGPTPlugin);
                return;
            }
            button.style.display = "block";
Chernfalin commented 1 year ago

Running normally in logseq 0.9.1.

debanjandhar12 commented 1 year ago

Will investigate and fix for v0.9.2 by tomorrow.

debanjandhar12 commented 1 year ago

I have fixed it temporarily by moving the ask chatgpt button to toolbar instead of pagebar (in v1.1.0). I think pagebar is broken in the new logseq version.