Skip to content

Commit

Permalink
fix: remove blink effect when refresh skeleton attribute
Browse files Browse the repository at this point in the history
fix #309
  • Loading branch information
gcusnieux committed Mar 23, 2021
1 parent 7ccef4b commit edcaf1b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/mixins/with-skeleton-attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,22 @@ export function withSkeletonAttribute(ParentClass) {

constructor() {
super();
this._reset();
}

_reset() {
this._invisible = true;
if (this._skeletonAttribute != null && this[`_${this._skeletonAttribute}`] != null) {
delete this[`_${this._skeletonAttribute}`];
}
this._skeleton = false;
this._error = false;
this._empty = false;
}

updated(changedProperties) {
if (this._skeletonAttribute != null && changedProperties.has(this._skeletonAttribute)) {
this._error = false;
this._empty = false;
this._reset();
const start = new Date().getTime();
let end = null;
const timer = setTimeout(() => {
Expand Down
9 changes: 9 additions & 0 deletions stories/charts/gv-chart-pie.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ export const Loading = makeStory(conf, {
storyWait(750, () => {
seriesResolver(series);
}),

storyWait(1500, ([component]) => {
component.series = new Promise((resolve) => (seriesResolver = resolve));
component.options = options;
}),

storyWait(2250, () => {
seriesResolver(series);
}),
],
});

Expand Down

0 comments on commit edcaf1b

Please sign in to comment.