Warn before closing a form with unsaved changes
Nobody has claimed this yet.
- Dominant language
- Elixir
- Stars
- 296
- Forks
- 86
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 50
Description
Starting with the job builder because it's the most high-impact, we need an elegant and generic way to detect when a form has unsaved changes (maybe through the validate hook?) then then display a warning before the user closes.
This is particularly important on the job builder since clicking anywhere else on the canvas will close the form. See @josephjclark 's old https://github.com/OpenFn/Lightning/issues/280
- When making changes to a job, a user's changes aren't saved until the "save" button is pressed (this itself is arguably a little bit anachronistic).
- If the user refreshes the page, navigates away or goes "back" (easily done with a misplaced gesture), all changes will be lost without warning.
- This is particularly painful when writing job code.
- Use click event on close/cancel to check changeset if changes exist
- If exists, call client event to do https://hexdocs.pm/phoenix_live_view/Phoenix.Component.html#link/1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the job builder form and its close/cancel click handling, then review how its changeset and validate hook expose unsaved changes. Check the referenced Phoenix LiveView link behavior for the client event. Done means refresh, navigation, back, and closing the form warn users before unsaved job changes are lost.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100