LivelyKernel / LivelyKernel/lively.next

Google Chart loader callback not working, which may point to something deeper with us

Open
#1,759 0 comments 0 reactions 0 assignees View on GitHub
📟 support inquiry
Dominant language
JavaScript
Stars
90
Forks
20
PR merge metrics
No merged PRs in 30d

Description

**What would you like to achieve?**
What Google recommends to load chart packages is
```

```
followed by
```
google.charts.load('50', { packages: packageList, mapsApiKey: 'AIzaSyA4uHMmgrSNycQGwdF3PSkbuNW49BAwN1I' });
google.charts.setOnLoadCallback(finishLoad); // or whatever function
```
Now, the problem is, in Lively, the calllback function _never gets called_. I tried a bunch of things -- attaching the callback to `window`, passing an anonymous function, but nothing worked. Eventually I settled on a polling solution (every 100ms checking on whether `google.visualization` was non-null). That worked, but, boy, what a kludge.
Now, it could well be that this is a Google bug. It wouldn't be the first or last time. But just in case it's something in Lively I thought I would pass it along.
The code is here:
```
$world.execCommand("open browser", {moduleName: "studio/index.js", packageName: "engageLively--galyleo-dashboard", codeEntity: "main"});
```
For development in the IDE I call `loadVisScript` by hand. In production, I added the script tag in the world's HTML header:
```
$world.execCommand("open browser", {moduleName: "studio/ui.cp.js", packageName: "engageLively--galyleo-dashboard", codeEntity: "GalyleoStudioWorld"});
```

**How are you trying to achieve that**

**Alternative solutions**
If applicable, what other solutions have you tried?

**Additional Resources**
Please provide links to any custom code that might be necessary to grasp your problem. Screenshots of custom component, etc. are also appreciated.

**Version**: Please paste the lively.next commit on which the problem occurred here (use the copy button of the Version Checker in the bottom left corner).
c725a776b26bd744331765a4881ba4c0557d2fea

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Google Charts loader behavior in the context of studio/index.js, where loadVisScript is called, and studio/ui.cp.js, where the production script tag is added. Compare the documented callback path with the current polling workaround; the issue is done when the callback works reliably or the failure is narrowed to an external Google loader problem.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.