Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change persistence type to session rather than local #182

Merged
merged 8 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!--
A new scriv changelog fragment.

Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Highlights ✨

- A bullet item for the Highlights ✨ category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Removed

- A bullet item for the Removed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Added

- A bullet item for the Added category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->

### Changed

- Change the persistence of client-side data to `session` rather than `local` ([#182](https://github.com/mckinsey/vizro/pull/182))

<!--
### Deprecated

- A bullet item for the Deprecated category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Fixed

- A bullet item for the Fixed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Security

- A bullet item for the Security category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
7 changes: 0 additions & 7 deletions vizro-core/docs/pages/user_guides/custom_charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,3 @@ The below examples shows a more involved use-case. We create and style a waterfa
[![Graph3]][Graph3]

[Graph3]: ../../assets/user_guides/custom_charts/custom_chart_waterfall.png


???+ warning

Please note that users of this package are responsible for the content of any custom-created component,
function or integration they write - especially with regard to leaking any sensitive information or exposing to
any security threat during implementation.
10 changes: 6 additions & 4 deletions vizro-core/docs/pages/user_guides/custom_components.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ vm.Parameter.add_type("selector", TooltipNonCrossRangeSlider)
marks=self.marks,
className="range_slider_control" if self.step else "range_slider_control_no_space",
value=value,
persistence=True,
persistence=True, persistence_type="session",
antonymilne marked this conversation as resolved.
Show resolved Hide resolved
allowCross=False, # (3)!
tooltip={"placement": "bottom", "always_visible": True}, # (4)!
),
Expand All @@ -153,7 +153,7 @@ vm.Parameter.add_type("selector", TooltipNonCrossRangeSlider)
else "slider_input_field_no_space_left",
value=value[0],
size="24px",
persistence=True,
persistence=True, persistence_type="session",
antonymilne marked this conversation as resolved.
Show resolved Hide resolved
),
dcc.Input(
id=f"{self.id}_end_value",
Expand All @@ -165,9 +165,9 @@ vm.Parameter.add_type("selector", TooltipNonCrossRangeSlider)
if self.step
else "slider_input_field_no_space_right",
value=value[1],
persistence=True,
persistence=True, persistence_type="session",
antonymilne marked this conversation as resolved.
Show resolved Hide resolved
),
dcc.Store(id=f"temp-store-range_slider-{self.id}", storage_type="local"),
dcc.Store(id=f"temp-store-range_slider-{self.id}", storage_type="session"),
],
className="slider_input_container",
),
Expand Down Expand Up @@ -355,3 +355,5 @@ vm.Page.add_type("components", Jumbotron)
Please note that users of this package are responsible for the content of any custom-created component,
function or integration they write - especially with regard to leaking any sensitive information or exposing to
any security threat during implementation.

By default, all Dash components in Vizro that persist client-side data set [`persistence_type="session"` to use `window.SessionStorage`](https://dash.plotly.com/persistence), which is cleared upon closing the browser. Be careful when using any custom components that persist data beyond this scope: it is your responsibility to ensure compliance with any legal requirements affecting jurisdictions in which your app operates.
7 changes: 0 additions & 7 deletions vizro-core/docs/pages/user_guides/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,3 @@ The full code for these different cases is given below.
for dataset_name, dataset in kedro_integration.datasets_from_catalog(catalog).items():
data_manager[dataset_name] = dataset
```


???+ warning

Please note that users of this package are responsible for the content of any custom-created component,
function or integration they write - especially with regard to leaking any sensitive information or exposing to
any security threat during implementation.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def build(self):
placeholder=self.placeholder,
type=self.input_type,
persistence=True,
persistence_type="session",
debounce=True,
className="user_input",
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def build(self):
options=full_options,
value=self.value if self.value is not None else [default_value],
persistence=True,
persistence_type="session",
className="selector_body_checklist",
),
],
Expand Down
1 change: 1 addition & 0 deletions vizro-core/src/vizro/models/_components/form/dropdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def build(self):
value=self.value if self.value is not None else default_value,
multi=self.multi,
persistence=True,
persistence_type="session",
className="selector_body_dropdown",
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def build(self):
options=full_options,
value=self.value if self.value is not None else default_value,
persistence=True,
persistence_type="session",
className="selector_body_radio_items",
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def build(self):
marks=self.marks,
value=value,
persistence=True,
persistence_type="session",
className="range_slider_control" if self.step else "range_slider_control_no_space",
),
html.Div(
Expand All @@ -112,6 +113,7 @@ def build(self):
value=value[0],
size="24px",
persistence=True,
persistence_type="session",
className="slider_input_field_left"
if self.step
else "slider_input_field_no_space_left",
Expand All @@ -125,11 +127,12 @@ def build(self):
step=self.step,
value=value[1],
persistence=True,
persistence_type="session",
className="slider_input_field_right"
if self.step
else "slider_input_field_no_space_right",
),
dcc.Store(id=f"temp-store-range_slider-{self.id}", storage_type="local"),
dcc.Store(id=f"temp-store-range_slider-{self.id}", storage_type="session"),
],
className="slider_input_container",
),
Expand Down
4 changes: 3 additions & 1 deletion vizro-core/src/vizro/models/_components/form/slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def build(self):
value=self.value or self.min,
included=False,
persistence=True,
persistence_type="session",
className="slider_control" if self.step else "slider_control_no_space",
),
dcc.Input(
Expand All @@ -104,9 +105,10 @@ def build(self):
step=self.step,
value=self.value or self.min,
persistence=True,
persistence_type="session",
className="slider_input_field_right" if self.step else "slider_input_field_no_space_right",
),
dcc.Store(id=f"{self.id}_temp_store", storage_type="local"),
dcc.Store(id=f"{self.id}_temp_store", storage_type="session"),
],
className="slider_inner_container",
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def expected_checklist():
value=["ALL"],
className="selector_body_checklist",
persistence=True,
persistence_type="session",
),
],
className="selector_container",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def expected_dropdown_with_all():
value="ALL",
multi=True,
persistence=True,
persistence_type="session",
className="selector_body_dropdown",
),
],
Expand All @@ -40,6 +41,7 @@ def expected_dropdown_without_all():
value="A",
multi=False,
persistence=True,
persistence_type="session",
className="selector_body_dropdown",
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def expected_radio_items():
value="A",
className="selector_body_radio_items",
persistence=True,
persistence_type="session",
),
],
className="selector_container",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def expected_range_slider_default():
id="range_slider",
className="range_slider_control_no_space",
persistence=True,
persistence_type="session",
min=None,
max=None,
marks=None,
Expand All @@ -44,6 +45,7 @@ def expected_range_slider_default():
size="24px",
step=None,
persistence=True,
persistence_type="session",
min=None,
max=None,
value=None,
Expand All @@ -54,12 +56,13 @@ def expected_range_slider_default():
placeholder="end",
className="slider_input_field_no_space_right",
persistence=True,
persistence_type="session",
step=None,
min=None,
max=None,
value=None,
),
dcc.Store(id="temp-store-range_slider-range_slider", storage_type="local"),
dcc.Store(id="temp-store-range_slider-range_slider", storage_type="session"),
],
className="slider_input_container",
),
Expand Down Expand Up @@ -96,6 +99,7 @@ def expected_range_slider_with_optional():
className="range_slider_control",
value=[0, 10],
persistence=True,
persistence_type="session",
),
html.Div(
[
Expand All @@ -110,6 +114,7 @@ def expected_range_slider_with_optional():
value=0,
size="24px",
persistence=True,
persistence_type="session",
),
dcc.Input(
id="range_slider_with_all_end_value",
Expand All @@ -121,8 +126,9 @@ def expected_range_slider_with_optional():
className="slider_input_field_right",
value=10,
persistence=True,
persistence_type="session",
),
dcc.Store(id="temp-store-range_slider-range_slider_with_all", storage_type="local"),
dcc.Store(id="temp-store-range_slider-range_slider_with_all", storage_type="session"),
],
className="slider_input_container",
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def expected_slider():
value=5,
included=False,
persistence=True,
persistence_type="session",
className="slider_control",
),
dcc.Input(
Expand All @@ -44,9 +45,10 @@ def expected_slider():
max=10,
value=5,
persistence=True,
persistence_type="session",
className="slider_input_field_right",
),
dcc.Store(id="slider_id_temp_store", storage_type="local"),
dcc.Store(id="slider_id_temp_store", storage_type="session"),
],
className="slider_inner_container",
),
Expand Down
Loading