kelciour / edit-field-during-review

3 stars 1 forks source link

Error on note delete right after webview load #8

Closed phu54321 closed 4 years ago

phu54321 commented 4 years ago

Reproduction step (1)

  1. Load a card on a reviewer. At least one edit field should be present
  2. Somehow reload the reviewer Webview. Example procedure below
    1. Open 'Add cards' dialog
    2. Change the destination deck to anything you want.
  3. Card after the webview refresh should be the same as one loaded on 1.
  4. Try to delete the note from the reviewer with Ctrl+Delete shortcut.

Reproduction step (2)

  1. Open a reviewer. Note w/ editable field should appear here.
  2. Without doing anything else, delete that note with Ctrl+Delete shortcut.

Error message

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.26 (70784154) Python 3.8.0 Qt 5.14.1 PyQt 5.14.1
Platform: Windows 10
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2020-09-24 17:58:33

Caught exception:
Traceback (most recent call last):
  File "aqt\webview.py", line 34, in cmd
  File "aqt\webview.py", line 114, in _onCmd
  File "aqt\webview.py", line 518, in _onBridgeCmd
  File "C:\Users\phu54321\AppData\Roaming\Anki2\addons21\1020366288\__init__.py", line 81, in myLinkHandler
    note = mw.col.getNote(nid)
  File "lib\site-packages\anki\collection.py", line 290, in getNote
  File "lib\site-packages\anki\notes.py", line 47, in __init__
  File "lib\site-packages\anki\notes.py", line 61, in load
TypeError: cannot unpack non-iterable NoneType object
kelciour commented 4 years ago

Hi @phu54321, thank you for the report and especially for the reproduction steps and I'm sorry but it might be already fixed about a month ago - https://github.com/kelciour/edit-field-during-review/issues/6

I couldn't reproduce it the last time but the fix theoretically should work as the add-on will simply ignore the note if it was deleted.

And I couldn't reproduce it now either, but that's fine as I don't want to bother with recording a video with ShareX or something or providing some more info how to reproduce it.

The add-on was updated some time ago to use hooks introduced in Anki 2.1.20+, but until Anki 2.1.33 it wasn't uploaded on AnkiWeb as the old version seemed to work fine for the most part. I changed the minimal supported version on AnkiWeb to Anki 2.1.25 and if you use Tools - Add-ons - Check for Updates, I think, Anki will report a new update for the add-on that can be installed and it will make it in sync with the current master branch.

Though at the moment there might be Assertion Error - https://github.com/kelciour/edit-field-during-review/issues/7 - if the card context changed for some reason, maybe the review screen was refreshed with a different note, and the error will make the add-on unusable until Anki is restarted. I'm not sure how to reproduce it but it can be safely ignored by updating the config file and setting Debug to false.

I'll close it for now, but just open it again or create a new issue if it will be still present.

Thank you.

phu54321 commented 4 years ago

Thanks for the info :) I'll update that