takluyver / cite2c

Citations in the Jupyter Notebook
MIT License
318 stars 35 forks source link

"sticky loading"? citeproc-js fails to retrieve each citation #41

Closed coltongrainger closed 6 years ago

coltongrainger commented 6 years ago

Hello,

After adding citations to a notebook and restarting the jupyter server, some (occasionally all) citations fail to load. Here's the debugger output from Firefox Version 63.0.3 (64-bit).

TypeError: item is undefined[Learn More] rendering.js:19:13

retrieveItem
http://localhost:8888/nbextensions/cite2c/rendering.js:19:13
CSL.Engine.prototype.retrieveItem
http://localhost:8888/nbextensions/cite2c/citeproc.js:1613:12
CSL.Engine.prototype.processCitationCluster
http://localhost:8888/nbextensions/cite2c/citeproc.js:3457:16
process_cell_citations
http://localhost:8888/nbextensions/cite2c/rendering.js:76:27
reprocess_all
http://localhost:8888/nbextensions/cite2c/rendering.js:116:17
success
http://localhost:8888/nbextensions/cite2c/rendering.js:133:17
u
jquery.min.js:2
fireWith
jquery.min.js:2
k
jquery.min.js:2
n/<
jquery.min.js:2
Exception in event handler for rendered.MarkdownCell TypeError: "item is undefined"

    retrieveItem http://localhost:8888/nbextensions/cite2c/rendering.js:19:13
    retrieveItem http://localhost:8888/nbextensions/cite2c/citeproc.js:1613:12
    processCitationCluster http://localhost:8888/nbextensions/cite2c/citeproc.js:3457:16
    process_cell_citations http://localhost:8888/nbextensions/cite2c/rendering.js:76:27
    md_cell_rendered http://localhost:8888/nbextensions/cite2c/rendering.js:103:9
    dispatch http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:2:41720
    handle http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:2:39774
    trigger http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:2:69549
    trigger http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:2:70138
    each http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:2:2571
    each http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:2:1238
    trigger http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:2:70117
    trigger http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:28677:13
    render http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:33474:17
    done http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:30566:11
    marked http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:30580:31
    marked http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:30578:8
    render http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:33438:13
    execute http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:33191:9
    execute_cells http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:44771:13
    execute_selected_cells http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:44783:9
    handler http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:48271:17
    <anonymous> http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:48997:25
    call http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:49099:36
    call_handler http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:34185:20
    handle_keydown http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:49322:20
    bind_events http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:49288:20
    dispatch http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:2:41720
    handle http://localhost:8888/static/notebook/js/main.min.js?v=9ff2eb1d7b82b8735bb6f86206d48c5a:2:39774
Arguments
​
0: "rendered.MarkdownCell"
​
1: Object { cell: {…} }
​
callee: Getter & Setter
​
length: 2
​
Symbol(Symbol.iterator): function values()
​
<prototype>: Object { … }
events.js:33
events.trigger
events.js:33
MarkdownCell.prototype.render/<
textcell.js:438
done
marked.js:1411
marked/<
marked.js:1425
marked
marked.js:1423
MarkdownCell.prototype.render
textcell.js:402
TextCell.prototype.execute
textcell.js:155
Notebook.prototype.execute_cells
notebook.js:2432
Notebook.prototype.execute_selected_cells
notebook.js:2444
handler
actions.js:164
<anonymous>
actions.js:890
ActionHandler.prototype.call
actions.js:992
ShortcutManager.prototype.call_handler
keyboard.js:554
KeyboardManager.prototype.handle_keydown
keyboardmanager.js:213
KeyboardManager.prototype.bind_events/<
keyboardmanager.js:179
dispatch
jquery.min.js:2
add/y.handle
jquery.min.js:2

expected result

I expect executing a markdown cell with a valid instance of <cite data-cite="foo/bar"></cite> to call

retrieveItem
http://localhost:8888/nbextensions/cite2c/rendering.js:19:13
CSL.Engine.prototype.retrieveItem
http://localhost:8888/nbextensions/cite2c/citeproc.js:1613:12
CSL.Engine.prototype.processCitationCluster

and render all citations in that cell appropriately.

attempted workarounds

  1. edit, and re-execute markdown cell
    • produces error above
  2. restart jupyter server
    • produces error above
  3. call window.location.reload() to try to force citeproj-js to run again
    • produces error above
  4. try 1 with google chrome
  5. go through notebook and at each instance of <cite data-cite="foo/bar"></cite>, use the tool bar to re-insert the citation
    • produces no errors, but is a hassle

Thank you, -Colton

coltongrainger commented 6 years ago

I cannot consistently reproduce the above error by restarting the jupyter server. Seems like I have to wait a few hours (3--24?) before the citations start to produce the above errors.

coltongrainger commented 6 years ago

No longer having this issue, closing. (I can only image that perhaps having a very new Zotero account caused some problems in the first 24 hours.)

takluyver commented 6 years ago

No idea what happened, but I'm glad it works for you now.