radio buttons initial option isn't updating on first load
See original GitHub issueDescription
I allow users to create another radio button option with a modal. When they submit that modal I want to add their new option to the radio buttons and set that new option as the initial option.
The new radio button does not pop up as selected even though I’m passing it as the initial option until I refresh the home page a 2nd time.
What type of issue is this? (place an x
in one of the [ ]
)
- bug
- enhancement (feature request)
- question
- documentation related
- example code related
- testing related
- discussion
Requirements (place an x
in each of the [ ]
)
- I’ve read and understood the Contributing guidelines and have done my best effort to follow them.
- I’ve read and agree to the Code of Conduct.
- I’ve searched for any related issues and avoided creating a duplicate issue.
Bug Report
Filling out the following details about bugs will help us solve your issue sooner.
Reproducible in:
package version: 3.2.0
node version:
OS version(s):
Steps to reproduce:
- Open a modal for a user to add a new option.
- Save that option when they submit the modal
- Refresh the home page with the new option pre-selected
Expected result:
What you expected to happen
Actual result:
What actually happened
Attachments:
Pre-selected radio button
Modal where user creates new option choices
New radio button option pops up, but it’s not selected as the initial option
Proof that I’m passing the correct initial option when I refresh the home page screen
When I click away and back to the home page (manual refresh) it selects the correct initial option
Issue Analytics
- State:
- Created 2 years ago
- Comments:28 (13 by maintainers)
@srajiang someone on the Slack API workspace seems to have solved it! https://community.slack.com/archives/C02C28Z3XA7/p1652815757214569
“This is the default/expected behavior - the client will keep the user’s input if they have made a selection on an element, even if you update the options/initial_option. As long as the block_id is not changed”
In your examples were you setting a block id or was it random every time? I was setting my block id and never changing it.
@srajiang @ben-nz I’m still running into this (what I assume is caching issue) in more situations and it’s quite annoying.
the block is defined as having initial value: ‘🙂, 😐, 🙁’
But it shows ‘Custom Multiple Choice’
This issue is appearing after another view is pushed on top of this one and then submitted so the modal is going back to this view and the
intial_option
is passed correctly but not showing correctly.