RocketChat / RocketChat/EmbeddedChat
UI Kit falsy values are lost in initial/state resolution for block elements
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 165
- Forks
- 381
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 1
Description
Description:
UI Kit block state helpers treat valid falsy values such as 0 and '' as if they were missing. Because getInitialValue and useUiKitState rely on truthy checks / || fallback logic, values like 0, empty string, or empty option values can be replaced by later fallbacks or initial values.
This affects block elements that legitimately use falsy values, such as linear_scale, plain_text_input, and select-based elements.
Steps to reproduce:
-
Render a UI Kit
linear_scaleelement withinitialValue: 5. -
Provide UI Kit state for the same
actionIdwithvalue: 0. -
Observe the rendered selected value.
-
Render a UI Kit
plain_text_inputelement withinitialValue: "prefilled". -
Provide UI Kit state for the same
actionIdwithvalue: "". -
Observe the rendered input value.
Expected behavior:
Valid falsy values should be preserved exactly:
0should remain0""should remain an empty string- empty option values should remain valid selected values
Fallbacks should only apply when the value is actually undefined (or absent).
Actual behavior:
Falsy values are treated as missing:
0falls back to the initial value or later fallback""falls back to the initial value- empty option values can be ignored during initial value resolution
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 by locating the UI Kit block-state helpers getInitialValue and useUiKitState, then trace how linear_scale, plain_text_input, and select-based elements resolve values. Reproduce the listed cases and verify that 0, empty strings, and empty option values remain selected or displayed instead of being replaced by initial or later fallback values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100