Skip to content

Commit 620d2b1

Browse files
committed
front: intervals editor - fix 2 bugs
- re-renders in loop if additionalData is not provided - select form does update the correct interval (and not the first selected)
1 parent 954fabe commit 620d2b1

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

front/src/common/BootstrapSNCF/SelectImprovedSNCF.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function SelectImproved<T extends string | SelectOptionObject>({
100100
</button>
101101
</span>
102102
)),
103-
[filteredOptions]
103+
[filteredOptions, selectItem]
104104
);
105105

106106
const shouldDisplayNewInputValue =

front/src/common/IntervalsDataViz/dataviz.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export const LinearMetadataDataviz = <T extends { [key: string]: any }>({
199199
* => we recompute the additionalData4viz
200200
*/
201201
useEffect(() => {
202-
if (fullLength > 0) {
202+
if (fullLength > 0 && additionalData.length > 0) {
203203
const croppedAdditionalData = cropForDatavizViewbox(
204204
additionalData,
205205
viewBox
@@ -452,6 +452,7 @@ export const LinearMetadataDataviz = <T extends { [key: string]: any }>({
452452
{additionalData4viz.map((item, index) => (
453453
<div
454454
className="item"
455+
key={`${item.begin}-${item.end}-${item.value}`}
455456
style={{
456457
width: `${((item.end - item.begin) / fullLength) * 100}%`,
457458
}}

0 commit comments

Comments
 (0)