Hi! When building a Block extension with <Form /> as described in the docs (Using Forms), the recommended pattern for dirty-state management is to use defaultValue on inputs. Example:
<Form onSubmit={handleSubmit} onReset={handleReset}>
<TextField
label="Name"
defaultValue={defaultName}
value={currentName}
onChange={setCurrentName}
/>
</Form>
This works fine for TextField (docs).
But when trying the same with Select, it doesn’t work:
<Form onSubmit={handleSubmit} onReset={handleReset}>
<Select
label="Category"
defaultValue={defaultCategory} //ignored
value={currentCategory}
onChange={setCurrentCategory}
options={[
{label: "Option A", value: "a"},
{label: "Option B", value: "b"},
]}
/>
</Form>
defaultValue is ignored because Select doesn’t list it in the props (docs), leaving only value.
Because of this, the dirty-state contract described in the Form docs can’t be achieved - you can’t reset or properly manage dirty state for a Select.
Is this a bug, or is there a recommended workaround for handling default values and dirty state with Select inside a Form?
Thanks in advance for any guidance.