Skip to content

Commit

Permalink
fix: Remove replay_lock in use_table_listener (deephaven#749)
Browse files Browse the repository at this point in the history
Removes `replay_lock` due to
deephaven/deephaven-core#5672
  • Loading branch information
jnumainville authored Aug 16, 2024
1 parent 8d95ec7 commit acf35ec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
7 changes: 2 additions & 5 deletions plugins/ui/src/deephaven/ui/hooks/use_table_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def use_table_listener(
dependencies: Dependencies,
description: str | None = None,
do_replay: bool = False,
replay_lock: LockType = "shared",
) -> None:
"""
Listen to a table and call a listener when the table updates.
Expand All @@ -85,7 +84,6 @@ def use_table_listener(
description: An optional description for the UpdatePerformanceTracker to append to the listener’s
entry description, default is None.
do_replay: Whether to replay the initial snapshot of the table, default is False.
replay_lock: The lock type used during replay, default is ‘shared’, can also be ‘exclusive’.
"""

def start_listener() -> Callable[[], None]:
Expand All @@ -95,20 +93,19 @@ def start_listener() -> Callable[[], None]:
Returns:
A function that can be called to stop the listener by the use_effect hook.
"""
if table is None or (not table.is_refreshing and not do_replay):
if table is None or not table.is_refreshing:
return lambda: None

handle = listen(
table,
wrap_listener(listener),
description=description, # type: ignore # missing Optional type
do_replay=do_replay,
replay_lock=replay_lock,
)

return lambda: handle.stop()

use_effect(
start_listener,
[table, listener, description, do_replay, replay_lock] + list(dependencies),
[table, listener, description, do_replay] + list(dependencies),
)
11 changes: 1 addition & 10 deletions plugins/ui/test/deephaven/ui/test_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,7 @@ def _test_table_listener(replay_table=table, listener_val=listener):
assert False, "listener was not called"

def test_table_listener(self):
from deephaven import DynamicTableWriter, new_table
from deephaven.column import int_col
from deephaven import DynamicTableWriter
import deephaven.dtypes as dht

column_definitions = {"Numbers": dht.int32, "Words": dht.string}
Expand All @@ -242,14 +241,6 @@ def test_table_listener(self):

self.verify_table_updated(table_writer, table, (1, "Testing"))

static_table = new_table(
[
int_col("Numbers", [1]),
]
)

self.verify_table_replayed(static_table)

def test_table_data(self):
from deephaven.ui.hooks import use_table_data
from deephaven import new_table
Expand Down

0 comments on commit acf35ec

Please sign in to comment.