Skip to content

Improve update of datasets to use correct dataset order #227

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

Merged
merged 2 commits into from
Jan 12, 2018

Conversation

sjurba
Copy link
Contributor

@sjurba sjurba commented Dec 6, 2017

This fixes #226 by maintaining the order of the nextDatasets while merging the data from currentDatasets.

Fixes #226

@benmccann
Copy link
Collaborator

@sjurba this PR will need to be rebased

@sjurba
Copy link
Contributor Author

sjurba commented Jan 8, 2018

@benmccann: reabased onto master.

src/index.js Outdated
const current =
currentDatasetsIndexed[this.props.datasetKeyProvider(next)];
if (current && current.type === next.type) {
//The data array must be edited in place. As chart.js adds listeneres to it.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

listeneres -> listeners

src/index.js Outdated
});
const { data, ...otherProps } = next;
//Merge properties. Notice weekness here if a property is removed
//from next, it will be retained by current and never dissapears.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dissapears -> disappears

src/index.js Outdated
current.data[pid] = next.data[pid];
});
const { data, ...otherProps } = next;
//Merge properties. Notice weekness here if a property is removed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weekness -> weakness

src/index.js Outdated
this.props.datasetKeyProvider
);

//We can safely replace the dataset array, as long as we retain the _meta property
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should put a space after each // for consistency with existing code

@sjurba
Copy link
Contributor Author

sjurba commented Jan 9, 2018

I read the first comment and thought: "spell checking comments.. A bit nitpicking maybe.." Then I read the second comment and was embarrassed. Then I read the third one. Sorry about that, and thank you for spell checking my comments. Fixed and amended.

@benmccann
Copy link
Collaborator

Thanks! I'll let @jerairrest review this PR since he's more familiar with the code. I just noticed those small issues

@jerairrest
Copy link
Collaborator

Looks good to me!

@jerairrest jerairrest merged commit f4dfc51 into reactchartjs:master Jan 12, 2018
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

Successfully merging this pull request may close these issues.

The order of series is not maintained when updating a chart
3 participants