Skip to content

Commit 2edd07d

Browse files
authored
Config is no longer updated by options setter (#8516)
1 parent b31352c commit 2edd07d

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/core/core.config.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,25 +80,21 @@ function mergeScaleConfig(config, options) {
8080
return scales;
8181
}
8282

83-
function initOptions(config, options) {
84-
options = options || {};
83+
function initOptions(config) {
84+
const options = config.options || (config.options = {});
8585

8686
options.plugins = valueOrDefault(options.plugins, {});
8787
options.scales = mergeScaleConfig(config, options);
88-
89-
return options;
9088
}
9189

9290
function initConfig(config) {
9391
config = config || {};
9492

95-
// Do NOT use mergeConfig for the data object because this method merges arrays
96-
// and so would change references to labels and datasets, preventing data updates.
9793
const data = config.data = config.data || {datasets: [], labels: []};
9894
data.datasets = data.datasets || [];
9995
data.labels = data.labels || [];
10096

101-
config.options = initOptions(config, config.options);
97+
initOptions(config);
10298

10399
return config;
104100
}
@@ -150,14 +146,18 @@ export default class Config {
150146
return this._config.options;
151147
}
152148

149+
set options(options) {
150+
this._config.options = options;
151+
}
152+
153153
get plugins() {
154154
return this._config.plugins;
155155
}
156156

157-
update(options) {
157+
update() {
158158
const config = this._config;
159159
this.clearCache();
160-
config.options = initOptions(config, options);
160+
initOptions(config);
161161
}
162162

163163
clearCache() {

src/core/core.controller.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class Chart {
159159
}
160160

161161
set options(options) {
162-
this.config.update(options);
162+
this.config.options = options;
163163
}
164164

165165
/**
@@ -444,7 +444,7 @@ class Chart {
444444
const me = this;
445445
const config = me.config;
446446

447-
config.update(config.options);
447+
config.update();
448448
me._options = config.createResolver(config.chartOptionScopes(), me.getContext());
449449

450450
each(me.scales, (scale) => {

0 commit comments

Comments
 (0)