Skip to content

Commit 810543a

Browse files
author
John Rogers
committed
Fix to #46
1 parent cc4407d commit 810543a

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/components/App.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,20 @@ function App() {
154154
if (fileInfos)
155155
return match(fileInfos, forceModel).then((data) => {
156156
let simpleApi = simplifyApi(data, fileInfos);
157+
158+
// Filter existing computedMatches to remove any references to removed instruments
159+
setComputedMatches(prev => {
160+
if (!prev) return prev;
161+
const validQuestionIndices = new Set(
162+
fileInfos.flatMap((f, i) =>
163+
f.questions.map((_, qIdx) => qIdx)
164+
)
165+
);
166+
return prev.filter(match =>
167+
validQuestionIndices.has(match.qi) && validQuestionIndices.has(match.mqi)
168+
);
169+
});
170+
157171
setApiData(simpleApi);
158172
});
159173
},

0 commit comments

Comments
 (0)