diff --git a/fiftyone/core/session/session.py b/fiftyone/core/session/session.py index e761300113..2c6d49c04d 100644 --- a/fiftyone/core/session/session.py +++ b/fiftyone/core/session/session.py @@ -417,7 +417,7 @@ def __init__( view_name=final_view_name, spaces=spaces, color_scheme=build_color_scheme(color_scheme, dataset, config), - group_slice=(dataset.group_slice if dataset else None), + group_slice=_pull_group_slice(dataset, view), ) self._client = fosc.Client( address=address, @@ -1317,3 +1317,15 @@ def _on_refresh(session: Session, state: t.Optional[StateDescription]): if session.dataset is not None: session.dataset.reload() + + +def _pull_group_slice( + dataset: t.Optional[fod.Dataset], view: t.Optional[fov.DatasetView] +) -> t.Union[None, str]: + if view is not None: + return view.group_slice + + if dataset is not None: + return dataset.group_slice + + return None