Skip to content

Commit

Permalink
Merge pull request #19461 from apache/fix-ssr-data-undefined
Browse files Browse the repository at this point in the history
fix(ssr): remove redundant SVG attributes with `undefined` value
  • Loading branch information
Ovilia authored Jan 3, 2024
2 parents f1d9eb5 + 7a26ce5 commit 9d61cbc
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/core/echarts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,14 @@ class ECharts extends Eventful<ECEventDefinition> {

zrender.registerSSRDataGetter(el => {
const ecData = getECData(el);
const dataIndex = ecData.dataIndex;
if (dataIndex == null) {
return;
}
const hashMap = createHashMap();
hashMap.set('series_index', ecData.seriesIndex);
hashMap.set('data_index', ecData.dataIndex);
hashMap.set('ssr_type', ecData.ssrType);
hashMap.set('data_index', dataIndex);
ecData.ssrType && hashMap.set('ssr_type', ecData.ssrType);
return hashMap;
});

Expand Down
2 changes: 1 addition & 1 deletion src/util/innerStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const setCommonECData = (seriesIndex: number, dataType: SeriesDataType, d
childECData.seriesIndex = seriesIndex;
childECData.dataIndex = dataIdx;
childECData.dataType = dataType;
childECData.ssrType === 'chart';
childECData.ssrType = 'chart';
});
}
}
Expand Down
38 changes: 37 additions & 1 deletion test/svg-ssr.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9d61cbc

Please sign in to comment.