obsidian-enhancing-export icon indicating copy to clipboard operation
obsidian-enhancing-export copied to clipboard

Obsidian 1.6中导出失败 (L.setMessage properties undefined)

Open Yefimm opened this issue 1 year ago • 13 comments

In Obsidian 1.6.0, when I export .md to .docx/.pdf, there's an error in console and exporting failed.

plugin:obsidian-enhancing-export:28 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'setMessage')
    at jn (plugin:obsidian-enhancing-export:28:1708)
    at HTMLButtonElement.be [as $$click] (plugin:obsidian-enhancing-export:28:9390)
    at HTMLDocument.kc (plugin:obsidian-enhancing-export:4:21272)
  jn              @ plugin:obsidian-enhancing-export:28|
  be             @ plugin:obsidian-enhancing-export:28|
  kc             @ plugin:obsidian-enhancing-export:4
  await in kc (async) 
  kc              @ plugin:obsidian-enhancing-export:4

Yefimm avatar May 11 '24 09:05 Yefimm

I'm having a similar error. I notice that Better BibTex updated about 3 days ago, and Pandoc Reference List updated recently as well (which fixed a bug I was having with the integration between the two). Don't know if that is relevant information or not, but sharing just in case.

Here is my error message, very similar to @Yefimm's above:

plugin:obsidian-enhancing-export:28 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'setMessage')
    at jn (plugin:obsidian-enhancing-export:28:1708)
    at HTMLButtonElement.be [as $$click] (plugin:obsidian-enhancing-export:28:9390)
    at HTMLDocument.kc (plugin:obsidian-enhancing-export:4:21272)

kerim avatar May 13 '24 02:05 kerim

Also worth noting that after a failed export and this error, one can't access the command palette in Obsidian until you quit and restart the app.

kerim avatar May 13 '24 03:05 kerim

I debugged this issue in obsidian (I didn't learn javascript so I didn't go deep into debugging), the exporting failed in function fn:

j && (L.setMessage(G.preparing(V.outputFileFullName)),

and the L is null. The plugin use the fn function only in two positions:

be = async()=>{
            const f = e.plugin;
            a(!0),
            await jn(f, c, P(j), P(E), P(W), P(s), G(), async()=>{
                l.showOverwriteConfirmation = P(s),
                l.lastExportDirectory = Be(l.lastExportDirectory, P(j)),
                l.lastExportType = P(W).name,
                await f.saveSettings(),
                e.onClose && e.onClose()
            }
            , ()=>{
                a(!1)
            }
            )
        }

and

if (n) {
    await jn(this, l, ge(this.settings.lastExportDirectory), void 0, n);
    return
}

It seems the last one excuted and reported this error?

Yefimm avatar May 13 '24 07:05 Yefimm

If I export with "previous" settings the error message is a bit different:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'setMessage')
    at jn (plugin:obsidian-enhancing-export:28:1708)
    at Object.callback (plugin:obsidian-enhancing-export:30:86419)
    at EK (app.js:1:2022595)
    at t.onChooseItem (app.js:1:2622770)
    at t.onChooseSuggestion (app.js:1:1567777)
    at t.selectSuggestion (app.js:1:1567327)
    at e.useSelectedItem (app.js:1:1565476)
    at Object.func (app.js:1:1562875)
    at e.handleKey (app.js:1:753621)
    at e.onKeyEvent (app.js:1:754877)

kerim avatar May 13 '24 07:05 kerim

Just updated to version 1.10.5 (released 2 hours ago), but it doesn't seem to address this bug. Behavior is the same as reported earlier.

kerim avatar May 14 '24 02:05 kerim

I think this is due to changes in version 1.6.0 of Obsidian, and it also has to do with the progress bar of Enhancing export. If you disable the "Show export progress bar" toggle in Enhancing export's settings, the error goes away.

FeralFlora avatar May 14 '24 09:05 FeralFlora

I think this is due to changes in version 1.6.0 of Obsidian, and it also has to do with the progress bar of Enhancing export. If you disable the "Show export progress bar" toggle in Enhancing export's settings, the error goes away.

This worked and the exporting successed.

Yefimm avatar May 14 '24 09:05 Yefimm

Yes, this solved the problem for me as well. Thanks!

kerim avatar May 14 '24 11:05 kerim

I think this is due to changes in version 1.6.0 of Obsidian, and it also has to do with the progress bar of Enhancing export. If you disable the "Show export progress bar" toggle in Enhancing export's settings, the error goes away.

@mokeyish It seems like loadProgress is undefined since 1.6.0. Any reference to progress that executes in exporto0o.ts will cause an error. Most likely, something changed in its implementation, so that loadProgress is not accessed correctly anymore. It is an undocumented part of the Obsidian API after all, and one marked as "internal" as well.

FeralFlora avatar May 15 '24 10:05 FeralFlora

@mokeyish Apparently, loadProgress has been deprecated, according to joethei in #plugin-dev on Discord: https://discord.com/channels/686053708261228577/840286264964022302/1240297541166174228

Some useful info here: https://github.com/Fevol/obsidian-typings/issues/51

FeralFlora avatar May 15 '24 20:05 FeralFlora

I haven’t received the 1.6 update on my MacOS yet, I’ll look into it and find an alternative method when it’s available.

mokeyish avatar May 15 '24 23:05 mokeyish

where did you download the version 1.6 from?

from here, the latest version is 1.5.12

https://github.com/obsidianmd/obsidian-releases/releases

mokeyish avatar May 17 '24 22:05 mokeyish

where did you download the version 1.6 from?

from here, the latest version is 1.5.12

https://github.com/obsidianmd/obsidian-releases/releases

It's an early access build for those with a catalyst license: https://help.obsidian.md/Licenses+and+payment/Catalyst+license

The release is listed here: https://obsidian.md/changelog/2024-05-09-desktop-v1.6.0/

FeralFlora avatar May 17 '24 22:05 FeralFlora

@mokeyish Obsidian 1.6 was released publicly on June 7th, so you should be able to debug this now: https://obsidian.md/changelog/2024-06-07-desktop-v1.6.2/

But like I said, the loadProgress API is no longer public, so it has to be replaced with some other loading screen, or removed.

FeralFlora avatar Jun 11 '24 12:06 FeralFlora