Skip to content

Commit

Permalink
wait for scripts to load before requesting text responses
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsbailey committed Sep 14, 2018
1 parent 98f0d92 commit a4e1880
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions apps/src/templates/teacherDashboard/sections.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ export function renderTextResponsesTable(section, validScripts) {
registerReducers({textResponses, scriptSelection, sectionData});
const store = getStore();
store.dispatch(setSection(section));
store.dispatch(loadValidScripts(section, validScripts));

const scriptId = store.getState().scriptSelection.scriptId;
store.dispatch(asyncLoadTextResponses(section.id, scriptId, () => {
ReactDOM.render(
<Provider store={store}>
<TextResponses sectionId={section.id}/>
</Provider>,
element
);
}));
store.dispatch(loadValidScripts(section, validScripts)).then(() => {
const scriptId = store.getState().scriptSelection.scriptId;
store.dispatch(asyncLoadTextResponses(section.id, scriptId, () => {
ReactDOM.render(
<Provider store={store}>
<TextResponses sectionId={section.id}/>
</Provider>,
element
);
}));
});
}

export function renderStatsTable(section) {
Expand Down

0 comments on commit a4e1880

Please sign in to comment.