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

Empty data causes other component blocking errors #9

Closed
Frozenfire92 opened this issue Aug 21, 2014 · 11 comments
Closed

Empty data causes other component blocking errors #9

Frozenfire92 opened this issue Aug 21, 2014 · 11 comments
Assignees
Milestone

Comments

@Frozenfire92
Copy link
Contributor

If you have an empty data object passed you will get the following error

Uncaught Error: url or json or rows or columns is required. 

This error will block any other components from rendering properly

@Glavin001
Copy link
Owner

It is strange that an error one Ember component will block another Ember Component from rendering. I will look into this. Thanks :).

@bkCDL
Copy link

bkCDL commented Jan 27, 2015

I experienced this too, but found a workaround by couching the chart inside a handlebars IF clause:

{{#if contentChart}}
        {{c3-chart
            data=contentChart
            axis=chartAxis
            bar=chartBarFormat
            pie=chartPieFormat
            donut=chartDonutFormat
            legend=chartLegendSettings
            tooltip=chartTooltipFormat
            color=chartColors
        }}
{{/if}}

Bryan

@KTKate
Copy link

KTKate commented May 22, 2015

Does that mean whatever you put as data= has to have a key titled 'columns', 'rows', 'json' or 'url'? I tried feeding it an array of numerical values and I'm getting this error.

@Glavin001
Copy link
Owner

We should add checks on the data to determine how it is handled. An empty value for data should fail silently, instead of crashing your Ember app or requiring the if helper as @bkCDL suggested.
I'll look into this.

@Glavin001 Glavin001 modified the milestone: v0.3.0 Sep 22, 2015
@psteininger
Copy link

@Glavin001 I can confirm that this is an issue. It stops google map from rendering.

@Glavin001
Copy link
Owner

@psteininger the temporary workaround I recommend would be #9 (comment)
If anyone submits a pull request fixing this issue I will gladly review and merge. Thank you!

@psteininger
Copy link

@Glavin001 the workaround doesn't work in my case. My data sits in controller.chart.data so things don't get messy (I got a config for maps and other stuff there). The issue is happening much earlier. A check for invalid data should happen inside chart computed property. I will try and fix it and do a PR if I manage.

@psteininger
Copy link

this is more of a note-to-self: in https://github.com/Glavin001/ember-c3/blob/master/addon/components/c3-chart.js#L118

I think the cleanest thing to do is wrap things in a try-catch block and re-org things a bit. The reason for it is that C3 already does comprehensive validation, and throws an exception when things aren't kosher. There is no point in doing this twice. we could miss something and still have the same issue under slightly different conditions.

@psteininger
Copy link

@Glavin001 looks like I will have to tackle this next week. I found another issue - using a nested property just isn't supported now. I would like to add that in as well. I think we should be able to pass a config object, which would be merged with defaults in the components and set up observer on the data attribute of config object.

I won't have time to finish this weekend, but I should be able to swing it on Monday

@maxwondercorn
Copy link
Collaborator

fixed with pr #86. Will be released with 1.0.0

@maxwondercorn
Copy link
Collaborator

See issue #77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants