@Bryan, thanks for your reply! I really appreciate it!
Oh, I see–I probably should have thought more about this. But, FYI, being able to tell people who publish their models on Compute Studio that they can create bokeh plots (we don’t support call backs, at least right now) and all we have to do is store and render them has worked out really well for us over the past ~6 months or so.
I was able to use regex and things work for the most part now:
const BokehComponent: React.FC<{ output: BokehOutput }> = ({ output }) => {
let js = output.data.javascript;
let exp = RegExp('{"roots":.+"version":"[0-9].[0-9].[0-9]"}');
let res = exp.exec(js);
console.log(res);
console.log(JSON.parse(res[0]));
let parsed = JSON.parse(res[0]);
let root_id = parsed.roots.root_ids[0];
let json_item = {
target_id: output.id,
root_id: root_id,
doc: parsed
};
console.log(output.data.html);
console.log(output.id);
// @ts-ignore
window.Bokeh.embed.embed_item(json_item);
return (
<Card>
<Card.Body>
<div id={output.id} data-root-id={root_id} className="bk-root"></div>
</Card.Body>
</Card>
);
};
The code is pretty ugly but it will work for preserving backwards compatibility with existing plots:
I am running into this error when I click on buttons on the plot:
SyntaxError: invalid escape sequence 2 bokeh-1.3.4.min.js:3
bind_constructFunctionN self-hosted:1221
Function self-hosted:1150
get bokeh-1.3.4.min.js:31
execute bokeh-1.3.4.min.js:31
click bokeh-widgets-1.3.4.min.js:31
click bokeh-widgets-1.3.4.min.js:31
render bokeh-widgets-1.3.4.min.js:31
sentryWrapped helpers.ts:90
If you have ideas for where I can look to resolve this, that’d be helpful. If not, I understand that I’m pretty far outside the normal use case.