Skip to content
Snippets Groups Projects
Commit b9c216ef authored by Lewis Liu's avatar Lewis Liu
Browse files

Fetching metrics/segments and their revisions in parallel

parent 3531ba41
No related merge requests found
......@@ -346,8 +346,10 @@ export const fetchMetricTable = createThunkAction(FETCH_METRIC_TABLE, (metricId,
const FETCH_METRIC_REVISIONS = "metabase/metadata/FETCH_METRIC_REVISIONS";
export const fetchMetricRevisions = createThunkAction(FETCH_METRIC_REVISIONS, (metricId, reload = false) => {
return async (dispatch, getState) => {
await dispatch(fetchRevisions('metric', metricId));
await dispatch(fetchMetrics());
await Promise.all([
dispatch(fetchRevisions('metric', metricId)),
dispatch(fetchMetrics())
]);
const metric = i.getIn(getState(), ['metadata', 'metrics', metricId]);
const tableId = metric.table_id;
await dispatch(fetchTableMetadata(tableId));
......@@ -380,8 +382,10 @@ export const fetchSegmentTable = createThunkAction(FETCH_SEGMENT_TABLE, (segment
const FETCH_SEGMENT_REVISIONS = "metabase/metadata/FETCH_SEGMENT_REVISIONS";
export const fetchSegmentRevisions = createThunkAction(FETCH_SEGMENT_REVISIONS, (segmentId, reload = false) => {
return async (dispatch, getState) => {
await dispatch(fetchRevisions('segment', segmentId));
await dispatch(fetchSegments());
await Promise.all([
dispatch(fetchRevisions('segment', segmentId)),
dispatch(fetchSegments())
]);
const segment = i.getIn(getState(), ['metadata', 'segments', segmentId]);
const tableId = segment.table_id;
await dispatch(fetchTableMetadata(tableId));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment