Document how to build a select whose options change - #88
Closed
KamilSztandur wants to merge 1 commit into
Closed
KamilSztandur wants to merge 1 commit into
KamilSztandur wants to merge 1 commit into
Conversation
The built-in select keeps its options final on purpose. For a list that depends on another field or on a request, document the workaround: a short controller on the concrete base class with a mutable list, a setOptions that prefill-clears a value no longer on it, and the == membership trap. In the custom-controller page, the fields index, the FAQ and the skill. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
KamilSztandur
requested review from
PiotrRogulski and
mateusz-pietras
as code owners
September 20, 2026 19:36
Collaborator
Author
|
Closed: the changing options list is the real gap and gets fixed in the package instead. New PR follows. |
|
Docs preview: https://advanced-forms-qjwz6d86t-leancode.vercel.app Built from 25c0558; the landing page is at |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The built-in select has a fixed list of options. There is no way to change it after the field is created. Common case: the list of instructors depends on the chosen aircraft, or the list of cities loads once the country is known. People hit this and read it as a missing feature.
We do not want to change the package here. A select over a fixed list is the model, and making options part of the field state is a bigger decision. What was missing is a documented way to do it yourself.
Solution
Docs only, no code change. A new section in the custom-controllers page shows a complete controller built on
AdvancedFieldController<V?, E>with its own mutable options list and asetOptionsmethod. When the selected value is no longer on the new list, it is cleared without counting as a user edit, so an untouched field shows no error until submit, and a field the user had picked from shows "required" right away. The section also warns that membership is checked with==, so an option deserialized from the server is not the same object as the one on the list.In this PR
docs/fields/custom.mdx, with the full controller and the==warning.The controller from the docs was run against the package in a throwaway test before writing it up.
🤖 Generated with Claude Code