Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yomitan spitting out errors when Anki is not opened #825

Closed
koiyakiya opened this issue Apr 16, 2024 · 2 comments · Fixed by #843
Closed

Yomitan spitting out errors when Anki is not opened #825

koiyakiya opened this issue Apr 16, 2024 · 2 comments · Fixed by #843
Labels
kind/bug The issue or PR is regarding a bug

Comments

@koiyakiya
Copy link
Member

koiyakiya commented Apr 16, 2024

Description
I didn't have Anki opened and usually that would just lead to a "Not connected" next to the Anki button, but now it's just spitting out errors (nothing seemed to break). This has never happened to me on any other version before.

Browser version
Chrome 123.0.6312.123

Yomitan version
2024.4.15

Exported settings file
yomitan-settings-2024-04-16-01-04-30.json

image
image

@koiyakiya koiyakiya added the kind/bug The issue or PR is regarding a bug label Apr 16, 2024
@paperclip-dayo
Copy link

Same, Yomitan 24.4.16.0 w/ Edge Dev 125.0.2518.0.
Extension constantly throws up "error" icon and spams console with "Anki not connected" when scanning words.
I have Anki integration disabled and never used it to begin with.

@01b6
Copy link

01b6 commented Apr 19, 2024

I also have Anki integration disabled and am getting this error in Firefox. It seems to have been introduced by ef43049
I don't really understand the codebase, but I tried to find the issue and it looks like Anki integration is enabled by event listeners spawned from this:

const displayAnki = new DisplayAnki(display, displayAudio);
displayAnki.prepare();

prepare() {
this._noteContext = this._getNoteContext();
/* eslint-disable @stylistic/no-multi-spaces */
this._display.hotkeyHandler.registerActions([
['addNoteKanji', () => { this._tryAddAnkiNoteForSelectedEntry('kanji'); }],
['addNoteTermKanji', () => { this._tryAddAnkiNoteForSelectedEntry('term-kanji'); }],
['addNoteTermKana', () => { this._tryAddAnkiNoteForSelectedEntry('term-kana'); }],
['viewNotes', this._viewNotesForSelectedEntry.bind(this)]
]);
/* eslint-enable @stylistic/no-multi-spaces */
this._display.on('optionsUpdated', this._onOptionsUpdated.bind(this));
this._display.on('contentClear', this._onContentClear.bind(this));
this._display.on('contentUpdateStart', this._onContentUpdateStart.bind(this));
this._display.on('contentUpdateEntry', this._onContentUpdateEntry.bind(this));
this._display.on('contentUpdateComplete', this._onContentUpdateComplete.bind(this));
this._display.on('logDictionaryEntryData', this._onLogDictionaryEntryData.bind(this));

As far as I can tell options.anki.enable is never checked so these events will always trigger even if Anki integration is disabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug The issue or PR is regarding a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants