Skip to content

Commit de4e25b

Browse files
committed
Fix race condition caused by incorrect date casted from serialized dashboard format
1 parent b56215e commit de4e25b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/dashboard/DashboardThunks.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { createLogThunk } from '../application/logging/LoggingThunk';
99
import { applicationGetConnectionUser, applicationIsStandalone } from '../application/ApplicationSelectors';
1010
import { applicationGetLoggingSettings } from '../application/logging/LoggingSelectors';
1111
import { NEODASH_VERSION, VERSION_TO_MIGRATE } from './DashboardReducer';
12+
import { Date as Neo4jDate } from 'neo4j-driver-core/lib/temporal-types.js';
1213

1314
export const removePageThunk = (number) => (dispatch: any, getState: any) => {
1415
try {
@@ -101,6 +102,16 @@ export const loadDashboardThunk = (uuid, text) => (dispatch: any, getState: any)
101102
throw `Invalid dashboard version: ${dashboard.version}. Try restarting the application, or retrieve your cached dashboard using a debug report.`;
102103
}
103104

105+
// Cast dashboard parameters from serialized format to correct types
106+
Object.keys(dashboard.settings.parameters).forEach((key) => {
107+
const value = dashboard.settings.parameters[key];
108+
109+
// Serialized Date to Neo4jDate
110+
if (value && value.year && value.month && value.day) {
111+
dashboard.settings.parameters[key] = new Neo4jDate(value.year, value.month, value.day);
112+
}
113+
});
114+
104115
// Reverse engineer the minimal set of fields from the selection loaded.
105116
dashboard.pages.forEach((p) => {
106117
p.reports.forEach((r) => {

0 commit comments

Comments
 (0)