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

fix(api-load): Allow false for unload #333

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/api/api.load.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extend(Chart.prototype, {
* | axes | The axes specified by data.axes will be updated. axes must be Object that has target id as keys. |
* | colors | The colors specified by data.colors will be updated. colors must be Object that has target id as keys. |
* | - type<br>- types | The type of targets will be updated. type must be String and types must be Object. |
* | unload | Specify the data will be unloaded before loading new data. If true given, all of data will be unloaded. If target ids given as String or Array, specified targets will be unloaded. |
* | unload | Specify the data will be unloaded before loading new data. If true given, all of data will be unloaded. If target ids given as String or Array, specified targets will be unloaded. If absent or false given, unload will not occur. |
* | done | The specified function will be called after data loaded.|
*
* @example
Expand Down Expand Up @@ -78,12 +78,10 @@ extend(Chart.prototype, {
}

// unload if needed
if ("unload" in args) {
if ("unload" in args && args.unload !== false) {
// TODO: do not unload if target will load (included in url/rows/columns)
$$.unload(
$$.mapToTargetIds(
isBoolean(args.unload) && args.unload ?
null : args.unload), () => $$.loadFromArgs(args)
$$.unload($$.mapToTargetIds(isBoolean(args.unload) && args.unload ? null : args.unload), () =>
$$.loadFromArgs(args)
);
} else {
$$.loadFromArgs(args);
Expand Down