Skip to content

add id to event elements#13

Open
JamesHutchison wants to merge 1 commit into
hot-reloadingfrom
add-id-to-event-elements
Open

add id to event elements#13
JamesHutchison wants to merge 1 commit into
hot-reloadingfrom
add-id-to-event-elements

Conversation

@JamesHutchison
Copy link
Copy Markdown
Owner

@JamesHutchison JamesHutchison commented Apr 18, 2024

Add's element ID to the response returned to the server

It allows for logic like this:

def get_input_by_id(e: dict, input_id: str) -> dict:
    for input in e["target"]["elements"]:
        if input.get("id") == input_id:
            return input
    raise Exception(f"Input not found: {input_id}")

Currently, inputs can only be grabbed by their index which is brittle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant