Repository navigation
Releases
2.3.1 — 2026-10-17
2.3.1 — 2026-10-17
Patch (dependency maintenance) release. No source code or public API changes;
backs the klinecharts upstream releases (10.0.3 → 10.1.0) and the matching
react-klinecharts wrapper (1.0.1 → 1.0.2). Typecheck, lint, the full test
suite (360 tests), and the build pass against the bumped versions. Backwards
compatible.
Changed
-
klinecharts
^10.0.3→^10.1.0(dev dependency).10.1.0is strictly
additive on the public type surface — diffing the published.d.tsbetween
10.0.3and10.1.0shows zero removed symbols. New: theStoreinterface
(whichChartextends) gainssetLayoutOptions(DeepPartial<Layout>)/
getLayoutOptions(): DeepRequired<Layout>; new exported types
CompareColorCallback,CandleBarColorCallbackand
CandleBarColorCallbackReturnStyle; and the candle bar, indicator OHLC and
last-price-mark style fields widen to also accept per-bar color callbacks
(CandleStyle.bar,IndicatorStyle.ohlc,CandleLastPriceMarkLineStyle.color,
the last-price-mark text / extend-textbackgroundColor).DeepPartial<T>
now passes function-typed fields through unchanged instead of mapping them
into partial objects — that is what makes the callback-typed style fields
assignable throughsetStyles, and it improves any consumer-held
DeepPartial<Styles>carrying functions. Nothing the library reads
(getStyles().overlay.line, tooltip styles) or writes (settings-built
DeepPartial<Styles>) is affected. -
react-klinecharts
1.0.1→1.0.2(dev dependency, and the same pin in
thedocs/examplesworkspace packages).1.0.2raises itsklinecharts
dependency to^10.1.0— bumping it here keeps a singleklinecharts@10.1.0
copy in the dependency tree — and adds one small feature of its own: a
reactivelayoutOptions?: DeepPartial<Layout>prop on<KLineChart>that
forwards to the newchart.setLayoutOptions(). The peer ranges
(klinecharts >=10.0.0,react-klinecharts >=1.0.0) are unchanged.
Notable upstream behaviour in klinecharts 10.0.4 / 10.1.0 (picked up automatically)
These ship in klinecharts and apply through the chart instance — no library
change is required to benefit:
- 10.1.0: new
setLayoutOptions(options)/getLayoutOptions()instance
methods update and read default layout options after initialization. - 10.1.0: candlestick colors, indicator OHLC bar colors and last-price
line/label colors can now be assigned dynamically per bar via callbacks,
instead of only the up/down compare rule. - 10.1.0: time-axis tick generation now selects and caches ticks by time
hierarchy — more stable tick labels and better scrolling performance. - 10.1.0: fixed
scrollByDistanceconflicting with an active fling-scroll
animation; axis scrolling/scaling stopping when the pointer left the axis
mid-drag; a rapid click far from the previous click not starting a new click
sequence; logarithmic y-axis labels and coordinate conversion for ranges
containing negative, zero or sub-1 prices; overlay y-axis labels rendered
repeatedly on non-default axes in multi-axis panes. - 10.0.4: consecutive realtime data updates in the same event loop now coalesce
indicator recalculations (the library'supdateBarpath benefits directly),
and pane heights are rounded after separator dragging, preventing subpixel
dimensions from causing continuous full repaints. - 10.0.4: fixed data-loader subscriptions not being removed when a chart is
destroyed; indicator update detection comparingfiguresonly by reference;
calcParams/figuressharing references with external objects after
indicator overrides (and explicitundefinedvalues replacing existing
options); a potential infinite loop when the y-axis tick interval is smaller
than floating-point precision (relevant to the sub-cent precision work in
2.3.0); y-axis width jitter from frequently changing realtime labels; drag,
zoom and crosshair state remaining active after a cancelled touch gesture;
and an exception when setting an unregistered locale (now falls back to
en-US).
2.3.0 — 2026-09-26
2.3.0 — 2026-09-26
Fixed
- Sub-cent symbols (PEPE, SHIB, …) rendered as a flat line with all axis
labels reading0.00. klinecharts clamps the candle-pane Y axis to
10^-pricePrecisionper tick and defaults to 2 decimals when the symbol
carries none: for a0.000005-priced token the data range (~2e-7) is far
below the0.01minimum span, so the axis force-expands to ±0.04 and the
candles collapse into a sub-pixel band. The terminal now detects the
precision implied by the smallest movement in the bars returned by the
initialgetHistoryKLineDataload (wicks, body, and adjacent-close deltas;
order-of-magnitude based, so float-subtraction noise like
65000.12 - 65000.11cannot inflate it) and feeds it back into the symbol
via a new internalENSURE_PRICE_PRECISIONaction — the chart re-scales and
the labels gain the missing decimals. Default-scale data detects nothing and
dispatches nothing (normal symbols never pay the extra symbol refresh), and
an explicitpricePrecisionon the symbol always wins. - A stale init could stamp the wrong symbol's auto-detected precision onto
the new symbol. The loader's generation counter only bumps once the NEW
symbol's init starts, so an old symbol's init resolving in the gap after
SET_SYMBOLwould fill the new symbol'spricePrecision— and the
explicit-precision guard would then keep the wrong value forever.
ENSURE_PRICE_PRECISIONnow carries the ticker and the reducer ignores
mismatches. - Workspace sync crashed with "Maximum update depth exceeded" when a sync
bridge'scellIdmatched no cell (REMOVE_CELLwhile the bridge stayed
mounted, or a typo'd id). The mirror effects dispatch whenever the cell
value differs — for a missing cell it ALWAYS differs — and the workspace
reducer built a freshcellsarray for the no-op dispatch, retriggering
the effect forever.SET_CELL_SYMBOL/SET_CELL_PERIODnow return the same
state reference when no cell matches. - Deleting the "Auto-save" layout permanently killed auto-save for the
session. The 5s sweep consumed the changed-content signature before the
write attempt, then found the entry gone and skipped the write — with the
stale id kept, every later sweep skipped too. The sweep now drops the stale
id and falls through to the create path. SET_LOADINGno longer re-renders the whole terminal when the flag is
unchanged. With overlapping init+forward requests the loader dispatches
the same boolean repeatedly; the reducer now returns the same state
reference (the existingSET_SCREENSHOT_URLpattern).- Overlay operations claiming a
groupIdscope were NOT scoped.
klinecharts v10's filter short-circuits on a valididand ignores
groupId/name:removeOverlay({ id, groupId })removed the overlay with
that id in ANY group, andoverrideOverlay({ id, groupId, … })additionally
merged ourgroupIdinto the victim (silently re-homing it). All id+group
call sites (drawing tools, price alerts, undo/redo, the alert reconciler)
now go throughutils/overlaysscoped helpers that verify the group BEFORE
calling by id and never forwardgroupIdinto the override payload. removeDrawingbypassed undo. OnlyremoveAllDrawingsrecorded an
overlays_removedaction; a drawing deleted via the list/Delete key was
unrecoverable and diverged the undo sequence. Single-drawing removal now
snapshots the overlay and records the same action shape.- Price alerts created mid-bar fired immediately for a wick that predated
the alert. The poller's baseline (previous bar close) plus the whole-bar
touchedsignal bypassed the documented "first observation never fires"
seed.useAlerts.addAlertnow stampscreatedAton the alert; a forming
bar that OPENED before that moment cannot fire the alert (baseline falls
back to the first observed price, wick signal suppressed). Alerts hydrated
from storage have nocreatedAtand keep the full wick detection. - Indicator alerts accept a bare indicator name. The poller resolved
targets byidonly, and v10's filter ignoresnamenext to a valid id —
an alert armed on"RSI"instead ofsub_RSIsat silent forever. Falls
back to a name lookup when the id misses. - Synced crosshairs never cleared when the cursor left the source chart.
klinecharts emits noonCrosshairChangeon mouseleave (the store's emit
gate requires a string paneId), so siblings kept a frozen line. The sync
bridge now listens for DOMmouseleave(the same gapuseCrosshairalready
patched locally) and broadcasts an empty crosshair, which clears the target
drawing without echo. sync.symbol/sync.periodconfig channels were silently ignored. The
outward report effects wrote the provider's symbol/period into the workspace
cell regardless of the flags. The channels now gate the outward report;
inward (cross-cell) linking stays the consumer's job, as documented.useCompare: remove→re-add while the first fetch was in flight
resurrected the stale fetch and discarded the fresh one. The post-await
guard checked only that the pending slot was occupied — by the NEWER fetch.
The pending map now carries a monotonically increasing generation (never
reset on remove, so a re-add can't reissue the same one) and a continuation
proceeds only when its own generation is still current.- Settings hook fired a phantom
onSettingsChangeon mount and transiently
overwrote stored settings with defaults. Hydration, notify and persist
effects share the mount commit but the closures saw the pre-hydration
defaults; the notify/persist effects now skip the pre-hydration commit and
the persistence baseline is seeded with the hydrated value. - A theme toggle permanently clobbered custom settings styles. The
settings bootstrap was a one-shot guard per chart instance, and
setStyles(theme)merges the full built-in preset over current styles. The
effect now owns the chart's style state: on theme change it rebases the
preset and re-applies the (persisted) settings on top; on settings change it
re-applies without the rebase; a recreated chart always receives the current
settings. - Hydration validated only the root shape of stored JSON. A corrupt nested
payload ({"main": "MA"}— string wherestring[]belongs) crashed
ChartCanvas'forEachat chart-ready; a garbage element in the alerts array
reconciled into a ghost overlay withid: undefinedthatremoveAlert
could never target. Stored indicators/alerts are now field-validated, with
corrupt entries dropped back to defaults. loadLayoutthrew on a truncated layout entry instead of returning
false.readLayoutEntryparsed without a shape check; entries lacking a
stateobject now degrade tonull. Layout index writes are deduped
(two providers sharing one backend race the index read-modify-write).- Forward pagination duplicated a bar with inclusive-
tofeeds (e.g.
BinanceendTime): klinecharts prepends the response verbatim. The loader
now drops anything not strictly older than the anchor, and the Datafeed
contract documentstoas exclusive + ascending order required. - Watchlist fixes. A row is added BEFORE subscribing (a feed emitting its
first quote synchronously insidesubscribeno longer loses it); a throwing
subscribein the period/feed reconciliation loop no longer leaves a
fresh-looking entry that blocks every retry (the ticker went permanently
silent); each subscription records the feed it was opened on, so a runtime
datafeed swap can no longer unsubscribe from — or leak on — the wrong feed. - Undo/redo history is capped at 100 entries (each carries a full
overlay/indicator snapshot; it grew unboundedly for the life of the chart). useMeasure:startMeasurebefore the chart exists no longer leaves the
mode stuck active with no overlay and no reconciliation.createOrderLinewith an already-existing id returnsnullinstead of
reporting success for a line klinecharts silently never created.useScriptEditorreconciles a vanished script indicator (wiped by a
layout load) instead of leavinghasActiveScripttrue with a dead Remove
button.useScreenshot.captureno longer throws on a tainted canvas — a
cross-origin image drawn by an overlay makestoDataURLthrow; the failure
is logged and the click handler survives.- Replay: a
getBarsentering the commit window afterstopReplaycould be
served the old replay slice — the every-render effect re-armed
replayActiveReffrom the stale state of the same commit. The ref is now
propagated one-way (cleared only);startReplaysets it. brushlegacy-index repair no longer retries on every animation frame
for strokes pointing past the loaded range; it re-runs only when the data
list length changes.- Docs:
TA.ema/rmaseed with an SMA of the firstperiodvalues
(TA-Lib convention), not Pine's first-value seed — the docstring previously
claimed full Pine parity. Watchlistchange/changePercentdocumented as
the forming bar's move, not the day change.
v2.2.0
Fixed
- Crosshair sync is time-based, not pixel-based.
useChartSyncforwarded
the whole crosshair object to every sibling (executeAction( "onCrosshairChange", data)). klinecharts v10'sChartImp.executeAction
callssetCrosshair(data, { notExecuteAction: true }), andStoreImp. setCrosshairrecomputesdataIndex/kLineData/timestampfromxvia
coordinateToDataIndex(x)on the receiving chart's own scale — so the
mirrored value was a pixel offset, and any sibling with a different scroll
position, zoom, timeframe or symbol landed on a different bar (four charts,
four dates under one crosshair). The source now converts its pixel to a
timestamp withconvertFromPixeland each target maps that timestamp back to
its own pixel withconvertToPixel, sending only{ x, paneId }.yis
dropped on purpose: a foreign instrument's price means nothing on another
scale, and klinecharts draws the horizontal line only whenyis present.
No echo loop —executeActionsets the crosshair with
notExecuteAction: true. - Scroll sync sent a bar index where a timestamp was expected.
getVisibleRange().realTois an (exclusive) BAR INDEX, not a timestamp, but
it was passed straight toscrollToTimestamp. That method binary-searches
the data list for the nearesttimestamp, so small integers always resolved
to the first bar and every sibling scrolled to the start of loaded history.
The right-most visible bar's real timestamp is now resolved from the data
list (clamped to the last bar when scrolled into the future) before
broadcasting. - The multi-chart example had the same two defects in its own sync hook
(crosshair driven by the never-populatedevent.dataIndex, scroll driven by
the private_chartStore); it now uses the same public, time-based path.
Trap worth recording: onCrosshairChange subscribers receive the RAW
crosshair — { x, y, paneId } — because the store executes the action with the
argument it was given, not with its enriched internal _crosshair.
Crosshair declares timestamp / dataIndex / kLineData, so
crosshair.timestamp type-checks silently and is always undefined on the
mouse path.
useCrosshairalways returnednull— same root cause. It read
event.kLineDataoff the raw crosshair, which is never populated, so the
bar panel never showed anything. It now resolves the bar itself:
convertFromPixel([{ x }], { paneId })→dataIndex→getDataList()[i]
(unclamped indices outside the loaded history map tonull). A supplied
event.kLineDatastill wins when present.useCrosshairnever cleared when the cursor left the chart. klinecharts
clears its crosshair onmouseleaveviasetCrosshair(), which leaves
_crosshair.paneIdundefined, andsetCrosshaironly emits
onCrosshairChangewhen that pane id is a string — so no event arrives and
the panel kept displaying the last bar indefinitely. The hook now listens for
mouseleaveon the chart root (whengetDom()is available), which restores
the documented "null when the cursor is off-chart" contract.
Added
src/workspace/useChartSync.test.tsx(+11): crosshair mirroring goes
pixel → timestamp → pixel (and never forwardsyor the source pixel),
no-op when the pixel maps to no bar,candle_panefallback when the sibling
lacks the source pane, per-channel disable, scroll mirroring of the
right-edge timestamp (with a regression guard against the bar index),
future-scroll clamping, and zoom mirroring.src/hooks/useCrosshair.test.tsx(+8): the bar is resolved from the pixel
(with correctchange/changePercent), a suppliedevent.kLineDatastill
wins,nullwhen the pixel maps to no bar or to an index outside the loaded
history,nullwhen the crosshair has nox, the defaultcandle_pane
fallback, and clear-on-mouseleaveplus listener teardown.
Fixed
useUndoRedoshared its history across instances. The undo/redo stacks
wereuseStateinside the hook, while the provider's recording slot and the
hotkeys are single-slot (owned by the first mounted instance). Every other
useUndoRedo()consumer therefore recorded nothing, permanently reported
canUndo === false, and popped an empty stack onundo(). The stacks now
live in a provider-owned store (createUndoRedoStore) that every instance
reads withuseSyncExternalStore, so all of them see — and undo — the same
history. The Ctrl+Z / Ctrl+Y / Ctrl+Shift+Z listener also moved to the
provider: one window listener per chart instead of one per instance (N-1 of
which bailed out immediately), still driving only the owning instance.ChartCanvasdropped the persisted indicator state on bootstrap. It
re-created the saved main/sub indicators fromstate.mainIndicators/
state.subIndicatorsonly, ignoringstate.indicatorAxesand
state.indicatorVisibility. After a reload an indicator bound to a secondary
Y-axis silently fell back to the pane default, and a hidden one came back
visible while the provider (and every checkbox) still claimed it was hidden.
Both maps are now applied throughIndicatorCreate(yAxisId,visible).useLayoutManager.loadLayoutkept the SAVED pane id. Sub-indicator panes
are minted per chart instance, so the restoredsubIndicatorsmap pointed at
pane ids that no longer existed — breaking collapse, reorder, axis overrides
and removal for every restored sub indicator. The id is now read back from
getIndicators({ id })after creation (likeaddSubIndicator), and sub
indicators are created without apaneIdso klinecharts cannot resurrect a
stale pane or merge two indicators into one.- Layout auto-save missed drawing-only edits. The 5s debounce re-armed only
whenmainIndicators/subIndicatorschanged, so adding, moving or
clearing drawings — which have no provider state and no klinecharts change
event — never scheduled a save, while an untouched chart still got an
"Auto-save" entry 5s after enabling. Auto-save is now a 5s sweep that
serializes the chart and writes only when the persisted content actually
differs from the last write. isSubIndicatorCollapsednever re-rendered. It read auseRefset, so a
UI rendering a collapse/expand button from it showed the pre-click state
forever, and the height saved before collapsing was lost whenever the hook
remounted (expand fell back to 100px). Collapsed panes now live in provider
state (collapsedPanes: paneId → height before collapse), cleared by
SET_CHARTsince pane ids are per-instance.useKlinechartsUISettingsstate was per-instance. Two components calling
the hook got independent copies, each writing the whole slice to the same
storage key, so a change in one panel was invisible to (and eventually
overwritten by) the other. Settings now live in a provider-owned store.
Two related defects went with it: the "apply initial settings" effect was
guarded by a one-shot ref, so a REPLACED chart instance never got the axis
settings /lastValueMarkre-applied — it is now keyed on the chart identity
and applies every style-backed setting (buildStyles) — and the
onSettingsChangecallback was in the effect's dep array, so an inline
consumer callback fired on every render (it is now read through a ref and
fires on real changes only).setDrawingVisible/setDrawingLockedcould hit a foreign overlay.
UnlikeremoveDrawing, they calledoverrideOverlay({ id, … })without
groupId: "drawing_tools", so an id collision with an order/alert line
toggled that one instead.- Annotations and order lines vanished on chart remount. An annotation
added before the chart was ready (or after a remount) existed only in state
with no overlay, and order lines kept ids pointing at overlays the new chart
instance did not have (soupdateOrderLinesilently no-oped). Both hooks now
reconcile their tracked entries onto every new chart instance, mirroring the
provider's alert-line reconciliation. - Alert / annotation ids could collide with hydrated ones. The module
counters (alert_1,annotation_1) restarted at 1 on every page load, so a
fresh entry could reuse the id of one restored from storage — duplicate React
keys and two overlays sharing an id. Ids now carry a per-load session tag. useCompareassigned duplicate colors. The palette index came from
symbols.length, so after removing a symbol the next one reused a color
still in use. It now picks the first palette color nobody uses yet.- Replay playback was O(n²) over a session. Every step (timer tick,
stepForward,stepBackward,seekTo) calledchart.resetData()with the
whole slice, so a 5 000-bar replay at 10 bars/s performed 5 000 reloads of an
ever-growing array. Steps are now grouped: the interval advances
ceil(speed / 6)bars per tick at a proportionally longer period, keeping the
same wall-clock pace with at most 6 reloads per second
(MAX_RELOADS_PER_SECOND, exported for tuning). Opt-inuseReplay({ maxBars })
additionally caps the buffered window for pathological histories. - The undo/redo stack survived a chart / symbol / period change. Entries
reference overlay ids that no longer exist after a reload, soundo()either
did nothing or removed a same-id overlay of the new symbol. The provider now
clears the history when the chart instance, symbol or period changes. - Redo of a drawing recreated it unlocked and visible. Only
name/
points/styleswere stored, solock,visibleandmodewere lost on
every undo → redo cycle. The payloads inuseDrawingTools(draw end,
remove-all snapshot) and the redo re-snapshot inuseUndoRedonow carry all
three. - Two
useDrawingToolstimers leaked. The initialqueueMicrotask
snapshot still ran after unmount (set...
v2.1.0
Integration-DX release prompted by third-party integration feedback.
Added
ChartCanvasforwards a ref to the klinechartsChartinstance —<ChartCanvas ref={chartRef} />works like<KLineChart ref={…} />upstream: populated on ready, reset tonullon unmount.ChartCanvasaccepts astyleprop, forwarded straight to the chart container<div>(same passthrough asclassName).style={{ height: 500 }}is the one-liner fix for the collapsed-height-chain failure.- Dev-only zero-height warning in
ChartCanvas— if the container still has zero height ~1.5s after mount (and is not deliberately hidden), a console warning explains the three ways to give it a height and points at the README "Chart sizing" section. Stripped from production builds. - README "Chart sizing" section — no default size, three ways to set a height,
height: 100%/min-height: 0pitfalls in flex/grid/dock layouts, late-sizing recovery note. Installation now shows a single command includingreact-klinecharts.
Changed
react-klinechartsis now a required peer dependency (thepeerDependenciesMeta.optionalmarker is removed). The./chartentry statically imports it, and the optional marker let consumers install without it and only discover the break as a bundler error. npm 7+ and pnpm auto-install required peers; the peer range (>=1.0.0) is unchanged.Datafeed.searchSymbolsis optional. Consumed by exactly one call site (useSymbolSearch), which now resolves to an empty result list when the method is absent. Docs updated.
Typecheck, lint, the full test suite (220 tests), and the build pass.
v2.0.4
Patch release backing the klinecharts upstream patches (10.0.1 → 10.0.3),
a full-codebase audit with 19 bug fixes followed by a hardening pass (13
risk-class fixes and 8 optimizations) and a self-review of that pass (9
further fixes), plus one small overlay-behaviour improvement that opts into a
new upstream option. Typecheck, lint, the full test suite (215 tests), and
the build pass. Backwards compatible (additive type exports only; see
Added).
Changed
-
klinecharts
^10.0.1→^10.0.3(dev dependency). Diffing the published
.d.tsbetween10.0.1and10.0.3shows zero removed symbols and exactly
one added field:Overlay.fixedZLevel(optional inOverlayTemplate/
OverlayCreate); all symbols the library imports are preserved. No
react-klinechartsbump is required —1.0.1depends on
klinecharts ^10.0.1, which already resolves to10.0.3, so the dependency
tree keeps a single klinecharts copy. The peer ranges
(klinecharts >=10.0.0,react-klinecharts >=1.0.0) are unchanged. -
depthOverlaynow declaresfixedZLevel: true. klinecharts 10.0.3 added
thefixedZLeveloverlay option, which keeps an overlay at its configured
zLevelwhile hovered instead of temporarily raising it above every other
overlay. The depth overlay deliberately renders atzLevel: -1(behind the
candle series);fixedZLevel: truemakes that placement sticky, so hovering
can no longer lift the liquidity bars over the candles. On klinecharts
< 10.0.3the property is unknown to the runtime and ignored, so behaviour
there is unchanged.
Fixed
A full-codebase audit (provider, hooks, overlays, indicators, data pipeline)
landed 19 fixes, each as a separate commit:
gannFanoverlay was impossible to draw.totalStepcounts points + 1,
sototalStep: 2finished the drawing after a single click; with
p2 === p1all nine ratio lines degenerated into one horizontal line.
NowtotalStep: 3.elliottWavenever collected its 6th point (totalStep: 6→ 5 points),
leaving the(5)label branch unreachable. NowtotalStep: 7, matching
fiveWaves.parallelogramvertex dragging was a silent no-op. The perform handlers
assigned to a nonexistentpoint.pricefield (klinecharts points carry
value), which also leaked an undefinedpricekey into persisted overlay
JSON. They now assign.value.- Alert crossings could fire spuriously after a symbol/period change. The
reset effect cleared a ref that was never read; the poller's real per-alert
baseline (prevValueByAlertMap) survived the change, so the new symbol's
first close was compared against the old symbol's last one. The poller now
reseeds on symbol/period change and the dead ref is removed. - Persisted alerts were never redrawn after a reload or chart remount. The
list hydrated into state and the poller kept working, but noalertLine
overlays existed andremoveAlertsilently no-oped. The provider recreates
the overlays whenever the chart instance appears. loadLayoutdestroyed alert lines and order lines — a bare
removeOverlay()matches every overlay — andsaveLayoutserialized them
as plain drawings, recreating them without id/groupId/lock (breaking the
alert line↔state pairing and duplicating them on every save). Layouts now
own only thedrawing_toolsgroup, restored drawings get the group id so
useDrawingToolscan manage them, and subsystem overlays
(alertLine/orderLine/depthOverlay/simpleAnnotation) captured by
pre-2.0.4 layouts are skipped on restore instead of resurrecting as ghost
drawings.updateIndicatorParamsupdated every same-named indicator (e.g.
main_MAandsub_MAsimultaneously) because it overrode by name only. It
now derives the canonical id from the pane.- Starting a replay leaked the live bar subscription. The replay flag
flips beforeresetData(), whose unsubscribe was swallowed by the loader's
replay gate — live ticks streamed into the chart on top of the replayed
prefix for the whole session, and a mid-replay symbol change leaked the old
symbol's channel.unsubscribeBarnow always reaches the datafeed. - A stale rejected data request could wipe the chart. The data loader's
catch path ignored the stale-generation guard: a late init rejection emptied
the freshly loaded chart, and a late forward rejection permanently disabled
forward pagination until the nextresetData. useCompare.addSymbolraced itself. The duplicate guard was checked
before the data fetch but written after it: a double-call registered two
indicators, and a removal issued mid-flight was undone when the fetch
resolved. A pending set now holds the slot for the whole flight.- Compare projections went stale on symbol/period change. The base prices
and timestamp map are baked into the registeredcalcclosure, so the old
anchor's scale was drawn over the new symbol (or the line silently became
nulls). Comparisons are now cleared on the change; re-adding re-anchors. - Script-editor indicators collided across provider instances. The
template used one global registry name, so running a script on chart B
recomputed chart A's indicator with B's code. The name is now salted per
hook instance (same pattern asuseCompare). resetToDefaultsdesynced the indicator last-value toggle.
setStyles(theme)restored klinecharts' built-inlastValueMark.show: falsewhile the settings state kepttrue; the library default is now
re-applied after the theme reset.- Symbol-search results resurrected after select/clear. Only
setQuery
cancelled the pending debounce/fetch;selectSymbolandclearResultsnow
share the same cancel helper. - Global Ctrl+Z / Ctrl+Y hijacked text inputs. The undo/redo keydown
handlerpreventDefault'd regardless of target, killing native text undo
in the symbol search, layout rename and script editor. Inputs, textareas
and contentEditable elements are now skipped. - Replay could not be restarted after finishing naturally (
isReplaying
stayedtrue, andstartReplaybailed on it). The double-start guard now
only blocks while unplayed bars remain. - Redo of
overlays_removedcould wipe every overlay on the chart. A
failed restore (createOverlayreturns null for an unregistered template)
put an undefined id into the redo payload, andremoveOverlay({ id: undefined })matches all overlays. The redo payload now only contains
successfully restored overlays, and redo skips entries without a string id. - Undoing an indicator removal restored it with library defaults. The
payload now snapshotscalcParams/styles/visiblebefore removal, and
the re-add paths apply them (hidden state is mirrored into the visibility
map). - Ichimoku Chikou span was shifted 2× offset away from TradingView. The
1.0.0 "look-ahead bias" fix readclose[i - offset](price line delayed,
extending to the last bar); the canonical lagging span displays
close[i + offset]at bariand endsoffsetbars before the last bar —
the displaced plot is the definition, and nothing unknown is shown at the
right edge. The indicator and its test now assert TradingView parity.
Added
ReplayDataLoaderContextis now exported from the package root.
createDataLoaderwas already public, but its options interface was not, so
consumers building custom loaders could not type the replay refs. Purely
additive.- New
layoutsstorage namespace.useLayoutManagernow persists layouts
through the provider storage adapter (see the layouts bullet under
Hardening), which required a namespace declaration in the storage
contract. Apps that don't configurestoragekeep the previous direct
localStoragekeys, so existing saved layouts survive the upgrade.
Hardening
The audit's risk findings — states that were not outright bugs yet but could
corrupt data or destabilize the UI under real-world conditions — each as a
separate commit:
- The data loader can no longer wedge the pipeline or misreport loading.
Three related defects. (1) Aforwardrequest arriving before any data
(oldestTimestamp === null) fell through without calling the callback, and
klinecharts clears its_loadinglatch only inside the callback — one such
request permanently blocked all future loads; a terminal callback now always
answers. (2) The loading flag was a boolean, so with an init and a forward
request in flight concurrently, whichever finished first flipped the UI to
"loaded"; an in-flight counter drives the flag now. (3) The stale-generation
guard was per-loader-instance: swapping thedatafeedprop builds a new
loader with its own counter, and an in-flight request from the old loader
could still deliver old-feed bars onto the freshly reset chart. The
generation counter is now a ref shared by every loader instance of one chart
(passed fromChartCanvas; deliberately not module-global, so workspace
charts never cross-invalidate each other). - RSI now seeds Wilder smoothing canonically.
TA.rsifed the running
average a fake leading0change, so the seed averaged
(0, chg₁ … chg_{p−1})instead of the firstperiodchanges: values began
one bar early and carried a decaying seed bias on every series with mixed
moves. The first RSI value now lands on barperiodwith the canonical
Wilder seed (hand-computed test included;RSI_TVinherits the fix). - Indicator move/reorder keeps the axis binding and visibility.
moveToMain/moveToSub/reorderSubIndicatorrecreated the indicator
withoutyAxisIdorvisibleand never migrated the tracking maps: a bound
indicator silently landed on the default axis whileindicatorAxeskept
pointing at the dead id, and a hidden indicator moved between panes
resurrected visible while...
v2.0.3
Patch (dependency maintenance) release. No source code or public API changes — backs the klinecharts upstream patch (10.0.0 → 10.0.1) and the matching react-klinecharts wrapper (1.0.0 → 1.0.1). Typecheck, lint, the full test suite, the library build, and the examples/docs builds all pass against the bumped versions. Backwards compatible.
Changed
-
klinecharts
^10.0.0→^10.0.1(dev dependency).10.0.1is a strictly additive patch on the public type surface — diffing the published.d.tsshows zero removed symbols and exactly one added type (IndicatorFigureStyleBase); all symbols the library imports (utils,registerFigure,registerIndicator,registerOverlay, and theOverlayTemplate/*Attrs/DeepPartial<Options>types) are preserved. -
react-klinecharts
1.0.0→1.0.1(dev dependency, and the same pin in thedocs/examplesworkspace packages).1.0.1is itself a one-line release that raises itsklinechartsdependency from^10.0.0to^10.0.1. Bumping it here eliminates the duplicate klinecharts copy the dependency tree previously held: with1.0.0the tree resolved toklinecharts@10.0.1(direct) andklinecharts@10.0.0(transitive viareact-klinecharts); with1.0.1both resolve to a singleklinecharts@10.0.1. Thereact-klinechartspeer range (>=1.0.0) is unchanged.
Notable upstream behaviour in klinecharts 10.0.1 (picked up automatically)
These ship in klinecharts and apply through the chart instance — no library change is required to benefit:
- Fixed a miscalculation in the built-in PVT indicator (the library exposes PVT as UI metadata over the built-in indicator, so the fix applies transparently).
- Fixed
rgbToHexusing the red channel value when converting the green/blue channels, and regex errors inhslavalidation and transparent-color detection. - Optimised Canvas rendering scheduling, resizing, and device-pixel-ratio handling; smoother/more consistent mobile inertial scrolling and touch handling that no longer drives page scroll or browser navigation gestures while dragging.
Full changelog: https://github.com/NemeZZiZZ/react-klinecharts-ui/blob/main/CHANGELOG.md
v2.0.2
Patch release with a bug fix for the multi-symbol comparison overlay. No new features; no public API changes (the hook's exported types and method signatures are unchanged). Backwards compatible.
Fixed
-
Comparison overlay no longer collapses the chart.
useComparedrew each compared symbol as a line of raw percentages ({ pct }, e.g. ±5) stacked on the candle pane, whose Y-axis is in price units (e.g. ~60000). klinecharts v10 folds indicator figure values into the pane's auto Y-axis range (YAxisImp.createRangeImp), so a small-range series blended with the candle price range and flattened the candles. The indicator now projects each compare close onto the main symbol's price scale relative to a shared anchor bar (the first candle where both symbols have a quote):value = mainBase * (compareClose / compareBase)The drawn
valuelives in the main price domain and shares the candle Y-axis, so the line overlays the candles without rescaling them. The real percentage change is no longer drawn — it is surfaced in the indicator tooltip via a newcreateTooltipDataSource(e.g.ETHUSDT %: +10.00%). The indicator template now declaresseries: "price"so klinecharts syncs its precision to the main symbol'spricePrecision, matching the built-inMA/AVPindicators. Placement on the candle pane (paneId: "candle_pane",isStack: true) was already correct and is unchanged.
v2.0.1
Patch release with bug fixes. No new features; no runtime breakage for consumers using the library's UI helpers (compareRules / setCompareRule(cr.key)).
Fixed
-
CompareRulevalue corrected from"prev_close"to"previous_close". klinecharts 10.0.0 definesCandleColorCompareRule = "current_open" | "previous_close", so the previous"prev_close"literal was an invalid enum value that klinecharts silently ignored — selecting the "previous close" comparison rule did nothing. Consumers usingcompareRules/setCompareRule(cr.key)are unaffected; if you held the literal"prev_close"in your code, update it to"previous_close"(it never worked at runtime anyway). -
Stale
datafeed/onSettingsChangein the dispatch context. The context value memoized these through refs that were never re-read, so when a consumer swapped thedatafeedprop at runtime (e.g. switching to an authenticated feed after login),useCompare,useSymbolSearch,useWatchlist,ChartCanvas, anduseKlinechartsUISettings'sonSettingsChangekept operating on the original value. Both props are now included in the memo dependency array. Note: if you pass an inlinedatafeedobject or arrow-functiononSettingsChangeon every render, wrap them inuseMemo/useCallbackto avoid re-rendering context consumers each render. -
CI:
prefer-constlint error inuseChartAxes.test.ts(let all→const all).
Full Changelog: v2.0.0...v2.0.1
v2.0.0 — Breaking: migrate to klinecharts 10.0.0 stable + react-klinecharts 1.0.0
Breaking Changes
Targets klinecharts ^10.0.0 (up from beta3) and react-klinecharts ^1.0.0 (up from 0.3.0). The klinecharts v10 stable release changed the createIndicator instance API and removed the imperative data API the replay hook relied on. Because this library exposes the raw Chart instance on its store (state.chart), those upstream changes are breaking for the public surface.
Migration Guide (1.x → 2.0.0)
-
Update peer dependencies. Bump
klinechartsto>=10.0.0andreact-klinechartsto>=1.0.0:npm install klinecharts@^10.0.0 react-klinecharts@^1.0.0
-
createIndicatorsignature changed (klinecharts 10.0.0). The 2nd-argument options object{ isStack, pane, yAxis }was removed; the 2nd argument is now a plainisStack: boolean, andpaneId/yAxisIdare properties of theIndicatorCreatevalue itself:-chart.createIndicator( - { name, id: `main_${name}` }, - { isStack: true, pane: { id: "candle_pane" }, yAxis }, -); +chart.createIndicator( + { name, id: `main_${name}`, paneId: "candle_pane", yAxisId: yAxis?.id }, + true, +);
-
createIndicatornow returns the indicator id, not the pane id. Read the pane id back viachart.getIndicators({ id })[0].paneId(the canonical v10 pattern). The library's own hooks already do this internally. -
Removed v9 imperative data API.
applyNewData,updateData,setPriceVolumePrecisionno longer exist on the klinechartsChart. Data flows through theDataLoader; precision is set viachart.setSymbol({ pricePrecision, volumePrecision }). -
Replay was rewritten (
useReplay). It now drives the chart through a replay-aware intercept insidecreateDataLoader+chart.resetData(). The hook's public return type is unchanged.
Added
- Multi-YAxis management API on
useChartAxes—createYAxis(override),removeYAxis(filter),getYAxes(filter?)wrapping klinecharts 10.0.0 multi-YAxis support. New typesYAxisFilterandYAxisre-exported from the package entry.
Changed
KlinechartsUIDispatchValuegained areplayActiveRef: RefObject<boolean>for synchronous replay-mode toggling (additive).createDataLoadergained an optional 3rd argumentreplay?: ReplayDataLoaderContextwiring the replay-aware intercept. Omitting it yields the previous (non-replay) behaviour.
Tests
189 passing (+11). MockChart rewritten for v10 (resetData, createYAxis / removeYAxis / getYAxes, realistic createIndicator / getIndicators bookkeeping, live __data getter).
Full notes: see CHANGELOG.md → ## 2.0.0.
v1.2.0 — Per-drawing API + reactive overlays
What's New
- Per-drawing API + reactive overlays (
useDrawingTools) — individual drawing state management with reactive overlay tracking