Skip to content

Commit

Permalink
Change method to _reset
Browse files Browse the repository at this point in the history
  • Loading branch information
maxschulz-COL committed Oct 20, 2023
1 parent ce4fd36 commit 508b3ca
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Uncomment the section that is right (remove the HTML comment wrapper).

### Changed

- Update warning for duplicated IDs in `data_manager` and `model_manager` to now recommend `Vizro._clear_state()` as a potential fix when working in a Jupyter notebook ([#120](https://github.com/mckinsey/vizro/pull/120))
- Update warning for duplicated IDs in `data_manager` and `model_manager` to now recommend `Vizro._reset()` as a potential fix when working in a Jupyter notebook ([#120](https://github.com/mckinsey/vizro/pull/120))

<!--
### Deprecated
Expand Down
2 changes: 1 addition & 1 deletion vizro-core/src/vizro/_vizro.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def _pre_build():
model.pre_build()

@staticmethod
def _clear_state():
def _reset():
"""Private method that clears all state in the vizro app."""
data_manager._clear()
model_manager._clear()
Expand Down
2 changes: 1 addition & 1 deletion vizro-core/src/vizro/managers/_data_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _add_component(self, component_id: ComponentID, dataset_name: DatasetName):
f"Component with id={component_id} already exists and is mapped to dataset "
f"{self.__component_to_original[component_id]}. Components must uniquely map to a dataset across the "
f"whole dashboard. If you are working from a Jupyter Notebook, please either restart the kernel, or "
f"use 'from vizro import Vizro; Vizro._clear_state()`."
f"use 'from vizro import Vizro; Vizro._reset()`."
)
self.__component_to_original[component_id] = dataset_name

Expand Down
2 changes: 1 addition & 1 deletion vizro-core/src/vizro/managers/_model_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __setitem__(self, model_id: ModelID, model: Model):
raise DuplicateIDError(
f"Model with id={model_id} already exists. Models must have a unique id across the whole dashboard. "
f"If you are working from a Jupyter Notebook, please either restart the kernel, or "
f"use 'from vizro import Vizro; Vizro._clear_state()`."
f"use 'from vizro import Vizro; Vizro._reset()`."
)
self.__models[model_id] = model

Expand Down

0 comments on commit 508b3ca

Please sign in to comment.