Skip to content

Commit

Permalink
fix(core): randomly missing axes
Browse files Browse the repository at this point in the history
Related to the async initialization of data sources. The problem was introduced
in v0.50.1.
  • Loading branch information
tuner committed Mar 22, 2024
1 parent eec620f commit 7d27354
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/core/src/data/sources/lazy/axisTickSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ export default class AxisTickSource extends SingleAxisLazySource {
this.params = params;
}

async load() {
// Force the ticks to be recalculated. This is needed because the async
// initialization process and non-deterministic order of events.
this.ticks = null;
this.onDomainChanged();
}

onDomainChanged() {
// Note, although this function is async, it is not awaited. Data are updated
// synchronously to ensure that the new ticks are available before the next frame is drawn.
Expand All @@ -61,7 +68,7 @@ export default class AxisTickSource extends SingleAxisLazySource {
? validTicks(scale, axisParams.values, count)
: tickValues(scale, count);

if (!shallowArrayEquals(ticks, this.ticks)) {
if (this.ticks == null || !shallowArrayEquals(ticks, this.ticks)) {
this.ticks = ticks;

const format = tickFormat(scale, requestedCount, axisParams.format);
Expand Down

0 comments on commit 7d27354

Please sign in to comment.