budibase icon indicating copy to clipboard operation
budibase copied to clipboard

Unsaved changes prompts

Open Rory-Powell opened this issue 3 years ago • 2 comments

Describe the feature request At the moment when there are unsaved changes to a datasource the page can be exited without confirming the change. This can be easy to miss as e.g. the rest datasource config is quite long and the save button is scrolled out of sight

CoS For pages with a Save button, add a modal when the page is changed with unsaved changes asking the user to confirm the discard. Example pages:

  • Datasource
  • Email
  • SSO
  • Organization

A snippet from the great @aptkingston that suggests a possible approach towards this

i would look at hooking into routify! we could do something like register a confirmation prompt in a new simple store in onMount of some component, and removing it onDestroy. then we'd have a new RoutifyTransitionManager.svelte (literally made up this name) that would hook in to the routify API and check if a confirmation prompt is registered when a navigation event occurs, and if it is then show a modal and wait for confirmation before proceeding with the routify action, or otherwise discard it just off the top of my head. but this would be a generic way that any component could request confirmation before leaving the page, by simply calling an action in a store would just need to check that the routify API lets us hook in like that

Routify supports a hook that might help us here

  • https://www.routify.dev/docs/helpers#before-url-change

Rory-Powell avatar Dec 14 '21 11:12 Rory-Powell