Skip to content

TimePicker Element not Supported in ViewStateValue Class #1265

@rei-0

Description

@rei-0

New TimePicker element is not supported in the ViewStateValue class.

Reproducible in:

slack-sdk==3.18.3

The Slack SDK version

slack-sdk==3.18.3

Python runtime version

Python 3.9.13

Steps to reproduce:

@app.command("/command")
def handle_mushi(ack, body, logger, client: WebClient):
    ack()
    logger.info(body)

    time_picker = TimePickerElement(action_id="timepicker_action", placeholder="Timepicker")
    input_block = InputBlock(label="timepicker", element=time_picker)
    blocks = [input_block]

    mushi_view = View(type="modal", title="Timepicker", submit="Submit", callback_id="timepicker_view", blocks=blocks)

    _ = client.views_open(trigger_id=body["trigger_id"], view=mushi_view)


@app.view("timepicker_view")
def handle_view_submission(view, ack):
    ack()
    _ = View(**view)

Expected result:

Expected initialization of View class from view dict succeeds (line _ = View(**view))

Actual result:

TypeError exception is raised due to unexpected __init__() method parameter in ViewStateValue class:

ERROR:mushi.time_selected:Failed to run listener function (error: __init__() got an unexpected keyword argument 'selected_time')
Traceback (most recent call last):
  File "bolt-python/slack_bolt/listener/thread_runner.py", line 120, in run_ack_function_asynchronously
    listener.run_ack_function(request=request, response=response)
  File "bolt-python/slack_bolt/listener/custom_listener.py", line 50, in run_ack_function
    return self.ack_function(
  File "slack-mushi/src/mushi/time_selected.py", line 41, in handle_view_submission
    _ = View(**view)
  File "python-slack-sdk/slack_sdk/models/views/__init__.py", line 77, in __init__
    self.state = ViewState(**self.state)
  File "python-slack-sdk/slack_sdk/models/views/__init__.py", line 155, in __init__
    value_object = ViewStateValue(**d)
TypeError: __init__() got an unexpected keyword argument 'selected_time'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Version: 3xbugM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedweb-client

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions