class_docstr: UI state tracker; mirrors state from frontend SelectionService.
  
  WARNING: this component is _stateful_, and in current form implements no
  locking or access control. We recommend using this only in a single-user,
  single-threaded context such as IPython or Colab notebooks.
docstr: Update state from the UI.
docstr_tok: ["Update","state","from","the","UI","."]
code: def update_state(
      self,
      indexed_inputs: list[types.IndexedInput],
      dataset: lit_dataset.IndexedDataset,
      dataset_name: str,
      primary_id: Optional[str] = None,
      pinned_id: Optional[str] = None,
  ):
      """Update state from the UI."""
  
      self._state.dataset_name = dataset_name
      self._state.dataset = dataset
  
      if primary_id:
          self._state.primary = dataset.index[primary_id]
      else:
          self._state.primary = None
  
      self._state.selection = indexed_inputs
  
      if pinned_id:
          self._state.pinned = dataset.index[pinned_id]
      else:
          self._state.pinned = None
  
file_path: lit/lit_nlp/lib/ui_state.py
imports: from typing import Optional
  import attr
  from lit_nlp.api import dataset
  from lit_nlp.api import types
label_desc: Use image node_id 3 for calling the UIStateTracker obj's underlying member method code with example usage: obj.update_state(indexed_inputs, dataset, dataset_name, primary_id, pinned_id) without return types