Skip to content

Commit 163e05a

Browse files
authored
fix(lmfs): Resolve Firefox crash by ensuring TaskLogs is initialized (#250)
This PR fixes a critical race condition that caused a crash on Firefox when loading LMFS datasets. The fix ensures the `TaskLogs` object is properly initialized and managed, restoring scheduled tasks map functionality.
1 parent af4b0cd commit 163e05a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/App.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import TimeSlider from "./TimeSlider";
77
import LogTable from "./LogTable";
88
import ToggleBar from "./ToggleBar";
99
import TripLogs from "./TripLogs";
10+
import TaskLogs from "./TaskLogs";
1011
import CloudLogging from "./CloudLogging";
1112
import {
1213
uploadFile,
@@ -59,7 +60,10 @@ class App extends React.Component {
5960
activeMenuIndex: null,
6061
initialMapBounds: null,
6162
selectedRowIndexPerDataset: [-1, -1, -1, -1, -1],
62-
currentLogData: this.props.logData,
63+
currentLogData: {
64+
...this.props.logData,
65+
taskLogs: new TaskLogs(this.props.logData.tripLogs),
66+
},
6367
dynamicMarkerLocations: {},
6468
visibleToggles: getVisibleToggles(this.props.logData.solutionType),
6569
};
@@ -454,12 +458,14 @@ class App extends React.Component {
454458
if (this.state.activeDatasetIndex === index) {
455459
log(`handlePruneClick: Pruning active dataset ${index}, updating state.`);
456460
const tripLogs = new TripLogs(data.rawLogs, data.solutionType);
461+
const taskLogs = new TaskLogs(tripLogs);
457462

458463
this.setState(
459464
(prevState) => ({
460465
currentLogData: {
461466
...prevState.currentLogData,
462467
tripLogs: tripLogs,
468+
taskLogs: taskLogs,
463469
solutionType: data.solutionType,
464470
},
465471
}),
@@ -697,6 +703,7 @@ class App extends React.Component {
697703
const data = await getUploadedData(index);
698704
if (data && data.rawLogs && Array.isArray(data.rawLogs) && data.rawLogs.length > 0) {
699705
const tripLogs = new TripLogs(data.rawLogs, data.solutionType);
706+
const taskLogs = new TaskLogs(tripLogs);
700707
const newVisibleToggles = getVisibleToggles(data.solutionType);
701708

702709
let newToggleOptions = { ...this.state.toggleOptions };
@@ -720,6 +727,7 @@ class App extends React.Component {
720727
currentLogData: {
721728
...prevState.currentLogData,
722729
tripLogs: tripLogs,
730+
taskLogs: taskLogs,
723731
solutionType: data.solutionType,
724732
},
725733
visibleToggles: newVisibleToggles,

0 commit comments

Comments
 (0)