RocketChat / Rocket.Chat.Apps-engine

The Rocket.Chat Apps engine and definitions.

Home Page:https://rocketchat.github.io/Rocket.Chat.Apps-engine/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IUIKitSurface State does not hold value if initialValue is used in a InputBlock

haemza30 opened this issue · comments

What?

When I am trying to read a value from IUIKitViewSubmitIncomingInteraction.IUIKitSurface.state:

  1. if the value of say a input box is unchanged (it uses initialValue) then I get undefined
  2. if the value of input box is altered (changed once from initialValue) I am successfully able to retrieve the value

Steps to reproduce?

  1. Create a block
    const block: InputBlock = { type: "input", label: { type: "plain_text", text: labelText, }, element: { type: "plain_text_input", placeholder: { type: "plain_text", text: 'Enter your ID', }, appId: 'app-id, blockId: 'block-id', actionId: 'action-id', initialValue: '12345' }, };

  2. Use the above block in UIKitSurfaceType.MODAL

  3. Try to retrieve the value of input box in the submit handler:
    const id = data.view.state.'block-id'.'action-id'; // here data is IUIKitViewSubmitIncomingInteraction

  4. If you don't change the initialValue of the input box you will get id as undefined, but if you even change a character in it it will work fine

PS

Expectation:

Must get value even if the input box has unchanged initialValue