Skip to content

Commit

Permalink
Fix annotation cache (#18788)
Browse files Browse the repository at this point in the history
  • Loading branch information
geido authored Feb 21, 2022
1 parent c491829 commit 5356343
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
12 changes: 6 additions & 6 deletions superset-frontend/src/chart/chartAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,14 @@ export async function getChartDataRequest({
);
}

export function runAnnotationQuery(
export function runAnnotationQuery({
annotation,
timeout = 60,
formData = null,
key,
isDashboardRequest = false,
force = false,
) {
}) {
return function (dispatch, getState) {
const sliceKey = key || Object.keys(getState().charts)[0];
// make a copy of formData, not modifying original formData
Expand Down Expand Up @@ -482,16 +482,16 @@ export function exploreJSON(
chartDataRequestCaught,
dispatch(triggerQuery(false, key)),
dispatch(updateQueryFormData(formData, key)),
...annotationLayers.map(x =>
...annotationLayers.map(annotation =>
dispatch(
runAnnotationQuery(
x,
runAnnotationQuery({
annotation,
timeout,
formData,
key,
isDashboardRequest,
force,
),
}),
),
),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ class AnnotationLayerControl extends React.PureComponent {
this.setState({ addedAnnotationIndex: annotations.length - 1 });
}

this.props.refreshAnnotationData(newAnnotation);
this.props.refreshAnnotationData({
annotation: newAnnotation,
force: true,
});

this.props.onChange(annotations);
}

Expand Down Expand Up @@ -239,8 +243,8 @@ function mapStateToProps({ charts, explore }) {

function mapDispatchToProps(dispatch) {
return {
refreshAnnotationData: annotationLayer =>
dispatch(runAnnotationQuery(annotationLayer)),
refreshAnnotationData: annotationObj =>
dispatch(runAnnotationQuery(annotationObj)),
};
}

Expand Down

0 comments on commit 5356343

Please sign in to comment.