-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: force visualization fetch to ensure recording for offline #3196
fix: force visualization fetch to ensure recording for offline #3196
Conversation
The visualization request stopped being recorded after recent changes. The componentDidUpdate method was taking care of the recording, but it doesn't work as before. This change ensures the visualization is fetched when the dashboard is marked for offline so that the request is properly cached.
🚀 Deployed on https://pr-3196.dashboard.netlify.dhis2.org |
@@ -96,6 +96,11 @@ class Item extends Component { | |||
await apiFetchVisualization(this.props.item) | |||
) | |||
|
|||
// force fetch when recording to allow caching of the visualizations request | |||
if (this.props.isRecording) { | |||
apiFetchVisualization(this.props.item) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to await this request?
It does look a bit weird to have the same request 5 lines above.
Also, no chance that this request would get triggered twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to await because we are not using the returned value.
The other fetch above needs the returned value for setting it in the Redux store.
I don't think it can be triggered twice because the recording can only happen once the dashboard is loaded.
But this needs testing.
…st' into fix/missing-offline-request-recording
Quality Gate passedIssues Measures |
42aa33a
into
feat/custom-plugins-rebased-latest
Key features
Description
The visualization request stopped being recorded after recent changes. The componentDidUpdate method was taking care of the recording, but it doesn't work as before.
This change ensures the visualization is fetched when the dashboard is marked for offline so that the request is properly cached.