Skip to content
This repository has been archived by the owner on Oct 29, 2022. It is now read-only.

TypeError message at startup on iPhone from this plugin #28

Closed
claremacrae opened this issue Apr 14, 2022 · 5 comments
Closed

TypeError message at startup on iPhone from this plugin #28

claremacrae opened this issue Apr 14, 2022 · 5 comments

Comments

@claremacrae
Copy link

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:

injectIcons() {
this.settings.mappedIcons.forEach(mapped => {
try {
//@ts-ignore
this.app.commands.commands[mapped.commandID].icon = mapped.iconID;
} catch (error) {
new Notice(error);
}
});
}

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
Copy link

QuaCKeReD commented Apr 14, 2022

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
Copy link

lguenth commented Apr 14, 2022

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

@claremacrae
Copy link
Author

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
Copy link
Owner

phibr0 commented Apr 15, 2022

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
Copy link
Author

Brilliant - thanks very much for fixing this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants