Only prompt user once when navigating away from file editor

Summary

This is a follow up to #53728 (closed). After those changes, a user now gets warned twice when hitting cancel.

Steps to reproduce

  1. Navigate to a file
  2. click edit
  3. Click cancel
  4. Observe two prompts

What is the current bug behavior?

The user gets prompted twice, warning them they will lose their changes.

What is the expected correct behavior?

A single prompt

Assignee Loading
Time tracking Loading