Summary
In computeRange (and the candle range helper), the absolute Y floor uses a falsy coalesce:
const minRange = rawRange * 0.1 || 0.4
Because || only falls through when the left side is exactly 0 / falsy, any tiny nonzero rawRange skips the 0.4 floor.
Impact
Near-flat or micro-priced series (common for low-priced tokens) produce a denormal-scale Y domain. That domain is then used by the Y-grid drawing loop (drawGrid / pickInterval). With a step size smaller than the floating-point ULP of the current value, val += fine never advances and the main thread hangs → browser “Page Unresponsive”.
Expected
- When
rawRange > 0 and finite, use the relative minimum span (rawRange * k).
- Apply the absolute floor (
0.4, or 0.04 in exaggerate mode) only when the span is zero / non-finite.
- Avoid forcing
0.4 for all tiny nonzero spans (that over-pads and flattens real micro volatility).
Suggested fix direction
Replace the || pattern with an explicit check, e.g.:
const relativeMin = rawRange * (exaggerate ? 0.02 : 0.1)
const absoluteFloor = exaggerate ? 0.04 : 0.4
const minRange =
rawRange > 0 && Number.isFinite(rawRange) ? relativeMin : absoluteFloor
Apply the same change to the candle range helper that currently uses range * 0.1 || 0.4.
Related
Grid-loop hardening (guards in pickInterval / drawGrid) is a useful defense-in-depth companion, but this floor bug is the primary domain-side cause of the hang for micro ranges.
Environment
Seen with liveline@0.0.7 in a React web app plotting USD prices around 1e-4–1e-5 with small relative moves.
Summary
In
computeRange(and the candle range helper), the absolute Y floor uses a falsy coalesce:Because
||only falls through when the left side is exactly0/ falsy, any tiny nonzerorawRangeskips the0.4floor.Impact
Near-flat or micro-priced series (common for low-priced tokens) produce a denormal-scale Y domain. That domain is then used by the Y-grid drawing loop (
drawGrid/pickInterval). With a step size smaller than the floating-point ULP of the current value,val += finenever advances and the main thread hangs → browser “Page Unresponsive”.Expected
rawRange > 0and finite, use the relative minimum span (rawRange * k).0.4, or0.04in exaggerate mode) only when the span is zero / non-finite.0.4for all tiny nonzero spans (that over-pads and flattens real micro volatility).Suggested fix direction
Replace the
||pattern with an explicit check, e.g.:Apply the same change to the candle range helper that currently uses
range * 0.1 || 0.4.Related
Grid-loop hardening (guards in
pickInterval/drawGrid) is a useful defense-in-depth companion, but this floor bug is the primary domain-side cause of the hang for micro ranges.Environment
Seen with
liveline@0.0.7in a React web app plotting USD prices around1e-4–1e-5with small relative moves.