Skip to content

Commit

Permalink
Preparing 1.0.14 release
Browse files Browse the repository at this point in the history
  • Loading branch information
emilhe committed Mar 5, 2024
1 parent 57585b4 commit 5b51e6c
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 5 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

All notable changes to this project will be documented in this file.

## [1.0.14] - 05-03-24

- Add new `validate` module, which adds an `assert_no_random_ids` that assets that Dash didn't generate any random component ids

## [1.0.13] - 05-03-24

### Added

- Add new `pages` module, which introduces the `page components` and `page properties` concepts
- Add new `validate` module, which adds an `assert_no_random_ids` that assets that Dash didn't generate any random component ids

## [1.0.12] - 04-02-23

Expand Down
29 changes: 29 additions & 0 deletions dash_extensions/validate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import dash.dependencies

# region Random component id generation

_set_random_id = dash.development.base_component.Component._set_random_id
_components_with_random_ids = []


def _collect_components_with_random_ids(self):
if not hasattr(self, "id"):
_components_with_random_ids.append(self)
return _set_random_id(self)


dash.development.base_component.Component._set_random_id = _collect_components_with_random_ids


def assert_no_random_ids():
"""
When a component is referenced in a callback, a random id is assigned automatically, if an id is not already set.
This operation makes the application _stateful_, which is *not* recommended. This function raises an assertion
error if any components have been assigned random ids, thereby forcing the developer to set ids for all components.
"""
if _components_with_random_ids:
return
raise AssertionError(
f"The following components have random ids: {', '.join([str(c) for c in _components_with_random_ids])}")

# endregion
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dash-extensions",
"version": "1.0.13",
"version": "1.0.14",
"description": "Extensions for Plotly Dash.",
"main": "build/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dash-extensions"
version = "1.0.13"
version = "1.0.14"
description = "Extensions for Plotly Dash."
authors = ["emher <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 5b51e6c

Please sign in to comment.