I have a lightning web component that uses user interaction to build up some hierarchical data on client-side. When the user is finished, she hits the "Apply" button and the data is sent to an imperative apex class which inserts the data into the db.
How can I detect that the user is trying to navigate away from the page, and present a modal dialog box warning that their data will be lost if they don't save it? I think that in aura this is done with lightning:unsavedChanges. That component appears to have no lwc equivalent.
Also, this LWC is rendered on a record detail page. It will cause several of the related record lists to change. How can I cause them to be re-rendered when the user's data is applied?