Skip to content

Commit

Permalink
Merge pull request #1529 from tradingview/fix-1406-hovered-source-mou…
Browse files Browse the repository at this point in the history
…se-event-on-series-add

fix hoveredSeries undefined during series removal and creation
  • Loading branch information
SlicedSilver committed May 8, 2024
2 parents 85b8807 + bead8cf commit 12e4eed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 4 additions & 4 deletions .size-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ module.exports = [
{
name: 'CJS',
path: 'dist/lightweight-charts.production.cjs',
limit: '48.16 KB',
limit: '48.17 KB',
},
{
name: 'ESM',
path: 'dist/lightweight-charts.production.mjs',
limit: '48.09 KB',
limit: '48.10 KB',
},
{
name: 'Standalone-ESM',
path: 'dist/lightweight-charts.standalone.production.mjs',
limit: '49.79 KB',
limit: '49.80 KB',
},
{
name: 'Standalone',
path: 'dist/lightweight-charts.standalone.production.js',
limit: '49.83 KB',
limit: '49.84 KB',
},
];
6 changes: 5 additions & 1 deletion src/api/chart-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,11 @@ export class ChartApi<HorzScaleItem> implements IChartApiBase<HorzScaleItem>, Da
seriesData.set(this._mapSeriesToApi(series), data);
});

const hoveredSeries = param.hoveredSeries === undefined ? undefined : this._mapSeriesToApi(param.hoveredSeries);
const hoveredSeries =
param.hoveredSeries === undefined ||
!this._seriesMapReversed.has(param.hoveredSeries)
? undefined
: this._mapSeriesToApi(param.hoveredSeries);

return {
time: param.originalTime as HorzScaleItem,
Expand Down

0 comments on commit 12e4eed

Please sign in to comment.