RosettaTechnologies / AnkiBrain

147 stars 20 forks source link

White screen when clicking 'Import' on Local Mode #4

Closed robkipa closed 5 months ago

robkipa commented 6 months ago

White screen when clicking 'Import' on the left side menu on Local Mode

AnkiBrain 0.7.2 Anki.app Version ⁨23.12.1 (1a1d4d54)⁩ MacOS 13.6.4 (22G513)

The following is logged in terminal:

Qt critical: TypeError: Cannot read properties of null (reading 'documentsStored') 'file:///Users/robkipa/Library/Application%20Support/Anki2/addons21/1915225457/webview/build/index.html:2,'
Qt critical: Uncaught TypeError: Cannot read properties of null (reading 'documentsStored') 'file:///Users/robkipa/Library/Application%20Support/Anki2/addons21/1915225457/webview/build/index.html:2,'
eshahrabani commented 6 months ago

Thanks for reporting. Looks like the issue is reading the documentsStored field in the user settings file. Can you go to your user_files dir and check for settings.json to see if there is a documentsStored field?

robkipa commented 6 months ago

The contents of my settings.json are as follows:

{
  "aiLanguage": "English",
  "automaticallyAddCards": true,
  "colorMode": "dark",
  "currentVersion": "0.7.2",
  "customPromptChat": "",
  "customPromptMakeCards": "",
  "customPromptTopicExplanation": "",
  "deleteCardsAfterAdding": true,
  "devMode": false,
  "documents_saved": [],
  "lifetime_total_cost": 0,
  "llmModel": "gpt-3.5-turbo",
  "showBootReminderDialog": false,
  "showCardBottomHint": true,
  "showSidePanel": false,
  "tempCards": [],
  "temperature": 0,
  "user": null,
  "user_mode": "LOCAL"
}

Adding "documentsStored": "~/", or a variant such as true/false, [], or 0 did not resolve it.

eshahrabani commented 6 months ago

I was not able to replicate this bug using an M2 Macbook Air in local mode. The documentsStored field is a property of the user object which is retrieved in server mode, but local mode uses the top-level documents_saved property in the settings.json file. Were you previously using AnkiBrain's server mode?

dv0zn3r commented 6 months ago

I have the same issue on M2 MacBook Air. White screen on pushing Import button. Have no idea whether the logs are the same as the OPs, but settings.json does not have "documentsStored:". There is no way to get rid of the white screen, except of restarting the app itself.

robkipa commented 6 months ago

@eshahrabani no, I installed and used only local mode.

@dv0zn3r you can try launching anki using terminal (type /Applications/Anki.app/Contents/MacOS/anki and hit enter) to view your logs in realtime.

dv0zn3r commented 6 months ago

@robkipa thanks! @eshahrabani I have the same log output in terminal.

Qt critical: TypeError: Cannot read properties of null (reading 'documentsStored') 'file:///Users/.../Library/Application%20Support/Anki2/addons21/1915225457/webview/build/index.html:2,'
Qt critical: Uncaught TypeError: Cannot read properties of null (reading 'documentsStored') 'file:///Users/.../Library/Application%20Support/Anki2/addons21/1915225457/webview/build/index.html:2,'
Qt warning: skipping QEventPoint(id=1 ts=0 pos=0,0 scn=826.945,417.472 gbl=826.945,417.472 Released ellipse=(1x1 ∡ 0) vel=0,0 press=-826.945,-417.472 last=-826.945,-417.472 Δ 826.945,417.472) : no target window 
dv0zn3r commented 6 months ago

I have done a clean install on MacBook Air 2015 and also a Windows machine. Same issue.

eshahrabani commented 6 months ago

@dv0zn3r Unfortunately I am having trouble replicating this bug. If you are familiar with javascript, can you try searching the repository and providing null checks or other safety guards around where documentsStored is being accessed? I suspect the code is trying to read either a null user object or a null documentsStored array (unclear from the message itself). Sorry for the trouble and if you are using server mode as a workaround I can happily add credits for you.

eshahrabani commented 5 months ago

Can those of you with this bug test out the new 0.7.3 update (merged #6) and confirm if the changes fixed the issue?

robkipa commented 5 months ago

Works for me now, thanks!