question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Debugging Traitlets and Backbone.js?

See original GitHub issue

Is 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:open
  • Created 3 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
ianhicommented, Jul 25, 2020

@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

1reaction
jvailcommented, Jul 28, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found