Problem with custom widgets in 0.12.5 (works in 0.12.3)

Hi,

A while ago I started to play around with bokeh with the idea to create a data analysis web app. I implemented a couple of custom widgets in coffee script that worked in Bokeh 0.12.3. Now that I have updated Bokeh to 0.12.5 I get the following error message in the web browser:

Uncaught TypeError: Cannot read property ‘prototype’ of undefined

at extend (open_file:74)

at open_file:82

at Object.custom/file_input.file_input (open_file:134)

at i (bokeh.min.js?v=d5277ec…:1)

at l (bokeh.min.js?v=d5277ec…:1)

at Object.custom/main (open_file:64)

at Object.i [as require] (bokeh.min.js?v=d5277ec…:1)

at outer (open_file:46)

at open_file:60

Does anyone have any idea what is going on? It seems to be JavaScript code that is autogenerated that yields this error. Have I overlooked something obvious in my implementation?

I attach a zipped version of an application that displays this issue.

Best Regards

Matts Björck

open_file.zip (9.08 KB)

Hi,

BokehJS used to be purely an internal implementation detail. We are working to stabilize it as best we can, but there are still currently sometimes changes that need to be made to put it on good footing for long-term maintainability. I think this section of the 0.12.4 migration notes might apply in your case:

  http://bokeh.pydata.org/en/0.12.5/docs/releases/0.12.4.html#custom-extension-import-export

Thanks,

Bryan

···

On Apr 6, 2017, at 16:05, [email protected] wrote:

Hi,

A while ago I started to play around with bokeh with the idea to create a data analysis web app. I implemented a couple of custom widgets in coffee script that worked in Bokeh 0.12.3. Now that I have updated Bokeh to 0.12.5 I get the following error message in the web browser:

Uncaught TypeError: Cannot read property 'prototype' of undefined
    at extend (open_file:74)
    at open_file:82
    at Object.custom/file_input.file_input (open_file:134)
    at i (bokeh.min.js?v=d5277ec…:1)
    at l (bokeh.min.js?v=d5277ec…:1)
    at Object.custom/main (open_file:64)
    at Object.i [as require] (bokeh.min.js?v=d5277ec…:1)
    at outer (open_file:46)
    at open_file:60

Does anyone have any idea what is going on? It seems to be JavaScript code that is autogenerated that yields this error. Have I overlooked something obvious in my implementation?

I attach a zipped version of an application that displays this issue.

Best Regards

Matts Björck

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/fc7d728f-17a8-4fc3-b285-5da86f9fde61%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
<open_file.zip>

Hi Bryan,

Thanks a lot for putting me on the right track, I had missed that migration guide. The migration guide helped but there was one additional thing (just if anyone else is experiencing the same thing). I imported InputWidget = require "models/widgets/input_widget"
and tried to inherit the view:
class FileInputView extends InputWidget.View

Looking at the source for input_widget code that does not work anymore. Changing it to
import {InputWidget, InputWidgetView} from "models/widgets/input_widget"
....
export class FileInputView extends InputWidgetView

did the trick.

Again, thank you. I appreciate the help.

Best Regards
Matts

Hi Matts,

I'm glad it's now working, and thanks for the extra note. The user guide:

  http://bokeh.pydata.org/en/latest/docs/user_guide/extensions.html

does now have things correctly demonstrated (i.e. "import {InputWidget, InputWidgetView}") which is probably the most important thing. However, if have any interest to submit a PR to update the historical migration guide as well, the relevant file is here:

  https://raw.githubusercontent.com/bokeh/bokeh/master/sphinx/source/docs/releases/0.12.4.rst

Thanks,

Bryan

···

On Apr 7, 2017, at 16:59, Matts Björck <[email protected]> wrote:

Hi Bryan,

Thanks a lot for putting me on the right track, I had missed that migration guide. The migration guide helped but there was one additional thing (just if anyone else is experiencing the same thing). I imported InputWidget = require "models/widgets/input_widget"
and tried to inherit the view:
class FileInputView extends InputWidget.View

Looking at the source for input_widget code that does not work anymore. Changing it to
import {InputWidget, InputWidgetView} from "models/widgets/input_widget"
....
export class FileInputView extends InputWidgetView

did the trick.

Again, thank you. I appreciate the help.

Best Regards
Matts

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/2ae13464-7280-4665-8358-79873f3bdfaa%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.