Debugging Traitlets and Backbone.js?
See original GitHub issueIs there a simple method to debug Traitlets when creating a custom widget?
I’ve spent hours trying to track down why my state hasn’t been updating, and it often has to do with a Traitlet not being updated because it is incompatible, or indexing that silently fails. Is this logged somewhere?
This is likely also a backbone issue. I’m mostly trying to update an array, which does not cause an event to fire:
const idx = this.model.get("hoveredImage")
const judgements = [...this.model.get("judgements")]
judgements[idx][0] = 1;
this.model.set("judgements", judgements);
this.model.save_changes();
does not work while this does:
const idx = this.model.get("hoveredImage")
const judgements = [...this.model.get("judgements")]
judgements[idx][0] = 1;
this.model.unset("judgements", { silent: true })
this.model.set("judgements", judgements);
this.model.save_changes();
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
Debugging Javascript (Backbone and Marionette)
Background. It is interesting to look at why the browser uses “child” to display the type of Backbone objects in the console /...
Read more >Custom widget - Jupyter Tutorial 0.9.0
js is an Model View Controller (MVC) framework that automatically synchronises widgets defined in the backend with generic Backbone.js models in the frontend: ......
Read more >Creating Custom Widgets Displayed in the Jupyter Notebook
Widgets use Traitlets to notify changes of the Python classes' ... The IPython widget framework relies heavily on Backbone.js for the ...
Read more >Solution: Visually Inspect Backbone.js View/Templates + ...
Most browsers provide console logging using the console.info(), console.debug(), etc. APIs. However, the format of the Log statements (i.e. date ...
Read more >Backbone Debugger
Developer Tools extension for debugging Backbone.js applications. Adds a panel under the Chrome Developer Tools that displays in real-time ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@cabreraalex something else I should have recommended is asking about this on the jupyter widgets gitter: https://gitter.im/jupyter-widgets/Lobby
Also maybe this would help (haven’t tried it, just found by googling) https://chrome.google.com/webstore/detail/backbone-debugger/bhljhndlimiafopmmhjlgfpnnchjjbhd?hl=en
We seem to have the same issues 😃 I had the same problem and I pass a sliced array into the set method otherwise backbone ignores the change since it just compares the old vs the new array in its isEqual fn with a === b and returns true if you don’t slice or clone the array.