RocketChat / RocketChat/EmbeddedChat

UI Kit falsy values are lost in initial/state resolution for block elements

Open
#1,235 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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:
  1. Render a UI Kit linear_scale element with initialValue: 5.

  2. Provide UI Kit state for the same actionId with value: 0.

  3. Observe the rendered selected value.

  4. Render a UI Kit plain_text_input element with initialValue: "prefilled".

  5. Provide UI Kit state for the same actionId with value: "".

  6. Observe the rendered input value.

Expected behavior:

Valid falsy values should be preserved exactly:

  • 0 should remain 0
  • "" 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:

  • 0 falls 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.