phibr0 / obsidian-advanced-toolbar

Advanced Toolbar - Obsidian Plugin | Enhances Obsidian Mobile's Quick Action Toolbar
GNU Affero General Public License v3.0
88 stars 3 forks source link

TypeError message at startup on iPhone from this plugin #28

Closed claremacrae closed 2 years ago

claremacrae commented 2 years ago

As discussed in Discord - inside-mobile:

On some phones, this message gets displayed at startup:

image

Text:

TypeError: undefined is not an object (evaluating
'this.app.commands.commands[mapped.commandID].icon = mapped.iconID')

@_quack figured out the only plugin with iconID in their vault was this one, and I was then able to confirm that when I just turn off this one plugin, that message disappears for me too.

Searching the code, it looks like it's here:

https://github.com/phibr0/obsidian-advanced-toolbar/blob/c709a7d236278c2253c708a046fbc454a0e58f31/src/main.ts#L151-L160

The //@ts-ignore is interesting. Does it suggest that there is a possible error case that is being ignored?

It would be helpful if there was a meaningful error message issued, like what the problem command was...

QuaCKeReD commented 2 years ago

As an additional the above, this breaks Obsidian on my iPhone 13 Pro - on both app store and insider versions

App starts up, loads everything, freezes, does same al over again, then goes to a grey screen...

EDIT: this isnt cause of break - have managed to recover iPhone operation and even with this error now it doesnt freeze

lguenth commented 2 years ago

Just chiming into say that this seems to be the same error as in #26.

claremacrae commented 2 years ago

Thanks Luke.

Because the error is caught, it's unclear to me how this could be preventing the rest of Obsidian from starting up.

(I'm not saying it isn't, only that I can't see how...)

phibr0 commented 2 years ago

I am aware of the issue, haven't had time to dig into it though.

The //@ts-ignore is interesting. Does it suggest that there is a possible error case that is being ignored?

The @ts-ignore is only there to disable the type checker, since the commands object isn't exposed in Obsidian's type definitions.

I will try to find some time today or later this weekend!

claremacrae commented 2 years ago

Brilliant - thanks very much for fixing this.