Skip to content

AI Tutor: add warning dialog when mid-accept/reject and trying to navigate between lab2 levels#72140

Merged
bencodeorg merged 6 commits into
stagingfrom
ben/simpler-navigation-blocker
Apr 21, 2026
Merged

AI Tutor: add warning dialog when mid-accept/reject and trying to navigate between lab2 levels#72140
bencodeorg merged 6 commits into
stagingfrom
ben/simpler-navigation-blocker

Conversation

@bencodeorg
Copy link
Copy Markdown
Contributor

@bencodeorg bencodeorg commented Apr 14, 2026

This PR adds a warning dialog if you try to navigate to another lab2 level when in the middle of accepting/rejecting AI Tutor changes. It offers the same behavior if you are using the forward/back browser history to navigate between levels. Finally, it also adds a "reject" event to your chat history if you do navigate to another lab2 level.

block.nav.mid.accept.reject.mov

Links

Testing story

Tested manually (see video above).

return;
}
// Notify the Lab2 system (that handles changing levels without reload) about the level change.
// The browser history API does not provide access to the state of the page we just came from,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true, but we're able to reconstruct the "from" page from Redux (see new logic), so I removed this comment.

@bencodeorg bencodeorg requested a review from a team April 14, 2026 23:30
Copy link
Copy Markdown
Contributor

@fisher-alice fisher-alice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool updates! And nice work on #72063 as well. Just left a small comments.

);

const dispatch = useAppDispatch();
const dialogControl = useDialogControl();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: maybe as a follow-up down the line, we could extract the navigation guard effects in a hook.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good thought, I like it!

await dispatch(rejectAiTutorVersion(files));
}, [dispatch, files]);

useEffect(() => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment here and the 'Block in-app level navigation...'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks! Added one to the useEffect below as well.

@bencodeorg bencodeorg merged commit a0d8703 into staging Apr 21, 2026
8 checks passed
@bencodeorg bencodeorg deleted the ben/simpler-navigation-blocker branch April 21, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants