91
Views
0
Comments
Is it possible to run a router guard/interceptor before leaving the current RWA page?
Application Type
Reactive
Service Studio Version
11.53.14 (Build 61220)

Hi,

I was wondering if there is a way to run some kind of router guard/interceptor before leaving the current Reactive Web App screen. This would be used to display a confirm window if the user has unsaved changes before navigating to another screen.

For any link on the screen, there's two cases for where the user could navigate to:

  • Outside the RWA (external site):
    • this can be handled by adding a 'beforeunload' Javascript event to the screen to display the confirm window. Relevant discussion
    • This is currently working using the above implementation, so no issues here.
  • Inside the RWA (screens inside the same module):
    • this is where I'm not sure
      • Ideally, I'm looking for some Javascript logic that could be run on the Screen to prevent navigation between pages in the RWA based on a browser confirm window value (see example in Vue below).
      • Couldn't find anything in OutSystem's documentation or in the forum for this
    • I tried using the OnDestroy lifecycle event, but that always seems to load the destination page

As a reference, this is how it could be accomplished in a Vue component. Hoping I could implement something similar to this on an OutSystems screen:

Has anyone run into a situation similar to this?



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.