Skip to content

Commit c896050

Browse files
committed
hot-fix: not re-fetching version data on mounting /questions screen
1 parent f32c4c6 commit c896050

File tree

2 files changed

+2
-37
lines changed

2 files changed

+2
-37
lines changed

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
nodejs 22.0.0
1+
nodejs 22.12.0
22
yarn 1.22.22

apps/web/app/author/(components)/AuthorQuestionsPage/index.tsx

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -260,45 +260,12 @@ const AuthorQuestionsPage: FC<Props> = ({
260260
if (assignmentId) {
261261
loadVersions().catch(console.error);
262262
}
263-
}, [assignmentId, loadVersions]);
263+
}, [assignmentId]);
264264

265265
useEffect(() => {
266-
if (checkedOutVersion && versions.length > 0) {
267-
if (assignmentId !== activeAssignmentId) {
268-
setActiveAssignmentId(assignmentId);
269-
}
270-
271-
const fetchCheckedOutVersion = async () => {
272-
try {
273-
const { checkoutVersion } = useAuthorStore.getState();
274-
await checkoutVersion(
275-
checkedOutVersion.id,
276-
checkedOutVersion.versionNumber,
277-
);
278-
} catch (error) {
279-
console.error("Failed to fetch checked out version:", error);
280-
}
281-
};
282-
void fetchCheckedOutVersion();
283-
return;
284-
}
285-
286266
if (assignmentId !== activeAssignmentId) {
287267
const fetchAssignment = async () => {
288268
try {
289-
const currentCheckedOutVersion =
290-
useAuthorStore.getState().checkedOutVersion;
291-
292-
if (currentCheckedOutVersion) {
293-
const { checkoutVersion } = useAuthorStore.getState();
294-
await checkoutVersion(
295-
currentCheckedOutVersion.id,
296-
currentCheckedOutVersion.versionNumber,
297-
);
298-
setActiveAssignmentId(assignmentId);
299-
return;
300-
}
301-
302269
const assignment = await getAssignment(assignmentId);
303270
if (assignment) {
304271
setActiveAssignmentId(assignmentId);
@@ -485,8 +452,6 @@ const AuthorQuestionsPage: FC<Props> = ({
485452
setName,
486453
setQuestions,
487454
setFocusedQuestionId,
488-
checkedOutVersion,
489-
versions,
490455
]);
491456

492457
useEffect(() => {

0 commit comments

Comments
 (0)