Skip to content

Commit

Permalink
Fix: filter was not updated in file status queries
Browse files Browse the repository at this point in the history
Due to the way the `q` variable was bound in the previous
implementation of the `setInterval` call, we were always querying the
file status using the filter (or lack thereof) that was in place in the
first show of the modal.

We now get the current value of `q` at the time in which the refresh
function is called.

See #2350
  • Loading branch information
matiasgarciaisaia committed Nov 13, 2024
1 parent 84b9840 commit cc88a7f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions assets/js/components/respondents/RespondentIndex.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,20 @@ class RespondentIndex extends Component<Props, State> {
}
}

showDownloadsModal() {
fetchFilesStatus() {
const { projectId, surveyId, filter } = this.props

// FIXME: don't fetch if we're already fetching
this.props.surveyActions.fetchRespondentsFilesStatus(projectId, surveyId, filter)
}

showDownloadsModal() {
const { projectId, surveyId, filter } = this.props

this.fetchFilesStatus()
if (this.state.filesFetchTimer == null) {
const filesFetchTimer = setInterval(() => {
this.props.surveyActions.fetchRespondentsFilesStatus(projectId, surveyId, filter)
this.fetchFilesStatus()
}, 20_000);
this.setState({ filesFetchTimer })
}
Expand Down

0 comments on commit cc88a7f

Please sign in to comment.