Skip to content

Commit

Permalink
Removing isinstance Table checking where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
petar-qb committed Oct 31, 2023
1 parent e0fbf97 commit ed09d14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
)
from vizro.managers import model_manager
from vizro.managers._model_manager import ModelID
from vizro.models import Table

logger = logging.getLogger(__name__)

Expand All @@ -25,11 +24,12 @@ def _build_action_loop_callbacks() -> None:

gateway_inputs: List[Input] = []
for actions_chain in actions_chains:
# Recalculating the trigger component id to use the underlying callable object as a trigger component if needed.
actions_chain_trigger_component_id = actions_chain.trigger.component_id
try:
actions_chain_trigger_component = model_manager[ModelID(str(actions_chain_trigger_component_id))]
# Use underlying table object as a trigger component.
if isinstance(actions_chain_trigger_component, Table):
# Use underlying callable object as a trigger component.
if hasattr(actions_chain_trigger_component, "_callable_object_id"):
actions_chain_trigger_component_id = actions_chain_trigger_component._callable_object_id
# Not all action_chain_trigger_components are included in model_manager e.g. on_page_load_action_trigger
except KeyError:
Expand Down
1 change: 1 addition & 0 deletions vizro-core/src/vizro/actions/_actions_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def _apply_table_filter_interaction(
if not ctd_active_cell["value"] or not ctd_derived_viewport_data["value"]:
return data_frame

# ctd_active_cell["id"] represents the underlying table id, so we need to fetch its parent Vizro Table actions.
source_table_actions = _get_component_actions(_get_parent_vizro_table(ctd_active_cell["id"]))

for action in source_table_actions:
Expand Down

0 comments on commit ed09d14

Please sign in to comment.