Comments (3)
So if I'm understanding the logic correctly - every submit button has a optional set_saved
entry. If provided, on pressing the submit button ULabel's edited
value gets updated to the value of set_saved
, effectively giving each button the power to fully invalidate or validate the edited
state, correct?
Is there ever a case where it's useful for a submit button to set edited
to false, forcing the prompt? I'd argue set_saved
should be a binary rather than an optional binary: it either sets the value to true or does nothing (defaulting to false rather than null).
from ulabel.
As of #135 a set_saved
argument is available for custom submit buttons, this is what I have been using to avoid the beforeunload
warning on custom submit navigation logic
from ulabel.
So if I'm understanding the logic correctly - every submit button has a optional
set_saved
entry. If provided, on pressing the submit button ULabel'sedited
value gets updated to the value ofset_saved
, effectively giving each button the power to fully invalidate or validate theedited
state, correct?Is there ever a case where it's useful for a submit button to set
edited
to false, forcing the prompt? I'd argueset_saved
should be a binary rather than an optional binary: it either sets the value to true or does nothing (defaulting to false rather than null).
A reminder that set_saved
is the opposite of the edited
state:
set_saved(true)
will setedited
tofalse
set_saved(false)
will setedited
totrue
The unload warning occurs when edited
state is true
If the button arg set_saved
defaults to false
, then in the case where no edits are made and then a submit button is pressed, the unload warning will appear bc the button itself is marking the edited
state as true
. So I agree that I honestly don't see a use case for setting edited
to true
on button click.
So as is, we can technically achieve three kinds of behavior:
set_saved: true
will NEVER show the unload warning when submittingset_saved: false
will ALWAYS show the unload waning when submittingset_saved: null
will show the unload warning when submitting only if something was edited
To go from optional binary to binary, we'd want to change set_saved: false
to be the default, while also changing its behavior to be that of set_saved: null
. So we lose the ability to ALWAYS show the unload warning, which i agree is useless anyways.
TL;DR the switch from optional binary to binary would eliminate one of the three current options, which also happens to be practically useless anyways 🤷
from ulabel.
Related Issues (20)
- Drawing utilities color channel helpers
- Linting / Precommit Hooks
- Reordering Toolbox with `KeypointSlider` errors out HOT 1
- Should probably have some geometry constructs
- Filter function exposure
- Scale Bar HOT 1
- More concise config parsing logic
- Better sanity checking of config defaults
- Document or Fix class ID sort order requirement
- Add `flyTo` API
- Can't use in vite + vue3 HOT 1
- Expose css image filtering options to UI
- Refactor type declarations
- Trying to redo a brush tool created polygon after undoing it causes an error
- Dialogs are not always visible HOT 2
- Submit Button Class Counts
- Button to toggle initial crop HOT 1
- Recolor annotation changing wrong class
- json2mask HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ulabel.