Skip to content

dh.ui data hook sentinel defaults are confusing #888

@mattrunyon

Description

@mattrunyon

Right now, we set empty tuples as the sentinel value for data hooks when it's a ticking table that is empty. This is not user friendly because the hook will return different data structures based on if there's data in the table or not.

Here's an example where we start w/ an empty tuple, then add data, then remove all data and are back to an empty tuple.

from deephaven import time_table, ui

_t = time_table("PT1S").update("X=ii").tail(5).where("X > 3 && X < 7")

@ui.component
def my_comp(t):
    data = ui.use_table_data(t)
    print(data)
    return t

t = my_comp(_t)

I recall there being some reason we wanted a sentinel value in these cases, but don't remember why. If we are sure we still need/want it then we should strongly consider changing the default to match the structure of the expected output. Changing the sentinel feels like an advanced feature and I'm not sure most people will care about it. They just want a consistent data structure for their data.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions