def handle_dataset_change(
    state: fos.StateDescription, initializer: AppInitializer
):
    """Handle a dataset change request.

    Args:
        state: the state description
        initializer: an app initializer
    """
    try:
        state.dataset = fod.load_dataset(initializer.dataset)
        state.group_id = None
        state.group_slice = state.dataset.group_slice
        state.sample_id = None
        state.selected = []
        state.selected_labels = []
        state.spaces = None
        state.view = None
    except:
        state.dataset = None
        state.group_id = None
        state.group_slice = None
        state.sample_id = None
        state.selected = []
        state.selected_labels = []
        state.spaces = None
        state.view = None
        return

    if initializer.group_id:
        state.group_id = initializer.group_id

    if initializer.sample_id:
        state.sample_id = initializer.sample_id

    if initializer.view:
        try:
            doc = state.dataset._get_saved_view_doc(
                initializer.view, slug=True
            )
            state.view = state.dataset.load_saved_view(doc.name)
        except:
            pass

    if initializer.workspace:
        try:
            doc = state.dataset._get_workspace_doc(
                initializer.workspace, slug=True
            )
            state.spaces = state.dataset.load_workspace(doc.name)
        except:
            pass
Handle a dataset change request.

    Args:
        state: the state description
        initializer: an app initializer
    
fiftyone/server/events/initialize.py