def handle_saved_view(
    state: fos.StateDescription, slug: t.Optional[str] = None
):
    """Handle a saved view slug.

    Args:
        state: the state description
        slug (None): an optional slug


    Returns:
        True/False indicating if a state update event should be dispatched
    """
    current_saved_view_slug = (
        fou.to_slug(state.view.name)
        if state.view is not None and state.view.name
        else None
    )

    if current_saved_view_slug == slug:
        return False

    try:
        if slug:
            doc = state.dataset._get_saved_view_doc(slug, slug=True)
            state.view = state.dataset.load_saved_view(doc.name)
        state.selected = []
        state.selected_labels = []
    except:
        pass

    return True
Handle a saved view slug.

    Args:
        state: the state description
        slug (None): an optional slug


    Returns:
        True/False indicating if a state update event should be dispatched
    
fiftyone/server/events/initialize.py