Skip to content

Commit

Permalink
removing change in runCypherQuery and reusing the status of the query…
Browse files Browse the repository at this point in the history
…Result correctly to trigger db change
  • Loading branch information
Alfred Rubin committed Nov 24, 2023
1 parent 172dd1c commit bdb5711
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/dashboard/DashboardThunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,11 @@ export const loadDashboardFromNeo4jByNameThunk =
};

export const loadDashboardListFromNeo4jThunk = (driver, database, callback) => (dispatch: any) => {
function setStatus(status) {
if (status == QueryStatus.NO_DATA) {
runCallback([]);
}
}
function runCallback(records) {
if (!records || !records[0] || !records[0]._fields) {
callback([]);
Expand All @@ -489,9 +494,7 @@ export const loadDashboardListFromNeo4jThunk = (driver, database, callback) => (
'MATCH (n:_Neodash_Dashboard) RETURN n.uuid as uuid, n.title as title, toString(n.date) as date, n.user as author, n.version as version ORDER BY date DESC',
{},
1000,
(status) => {
status == QueryStatus.NO_DATA ? runCallback([]) : () => {};
},
(status) => setStatus(status),
(records) => runCallback(records)
);
} catch (e) {
Expand Down

0 comments on commit bdb5711

Please sign in to comment.