Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error invoking SVGAnalyzer #6

Closed
tom1980west opened this issue Apr 19, 2016 · 3 comments
Closed

Error invoking SVGAnalyzer #6

tom1980west opened this issue Apr 19, 2016 · 3 comments

Comments

@tom1980west
Copy link

When I include the aurelia.use.plugin("grofit/aurelia-chart"); in my solution, I get the following exception from the browser:

aurelia-pal.js:20 Uncaught (in promise) Error: Error invoking SVGAnalyzer. Check the inner error for details.
------------------------------------------------
inner error: TypeError: _aureliaPal.DOM.createElement is not a function

I presume as I'm on the latest version of Aurelia, there are some breaking changes in there that have caused this?

I'm pretty new to this stuff, so not really sure how to proceed.

@grofit
Copy link
Owner

grofit commented Apr 19, 2016

Possibly, I only updated this a week or so ago, I am pretty sure you dont need the "grofit/aurelia-chart" and just need aurelia.user.plugin("aurelia-chart");, give that a try and see if it still blows up.

@tom1980west
Copy link
Author

Manage to resolve it - don't believe it was an issue with your library as removing all of the JSPM packages and re-installing them seem to fix it, as stated here.

One question I do have. I can get it working with a static dataset, but if I bind it via an fetch call to a web service, the chart is binding before the promise is completed. Is there a way to debounce the bind? I've tried playing around with the should-update flag, but it doesn't seem to help.

@grofit
Copy link
Owner

grofit commented Apr 20, 2016

The should-update flag basically triggers a model walk and all properties which are subscribable are subscribed to within a group, so basically if any of them change, it triggers a single subscription callback (all handled internally).

So if you are replacing the entire data model I imagine the should-update would not help as the existing subscriptions would no longer be applicable (could also be a possible memory leak), then when the new data is set it would probably trigger the binding again which may reset everything.

Ultimately you should only update the model when you have data, so your promise should be something like:

doSomeAjaxCall()
.then((result) => {
   someViewModel.chartData = result;
});

I don't know how your promise stuff works but it would be odd for the data in the model to "change" during a promise, you generally set it once you get the data from the request, the only scenario I can think of is that you are assigning the actual promise to the data variable (which I would probably say is bad) and then a the end of the promise you return out the data. If this is the case I would suggest you just set the data at the end of your promise has actioned.

(Will close this issue but feel free to continue this conversation here or pm me on the aurelia gitter)

@grofit grofit closed this as completed Apr 20, 2016
grofit added a commit that referenced this issue Apr 21, 2016
…ry leak on cleanup (#8) there is still an outstanding issue where if the internal value changes of a dynamically added array element it is not tracked, I am hoping someone else comes up with a model observer within the context of aurelia, then I can just use that and remove the current model observer class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants