Skip to content

Commit 6af9973

Browse files
committed
Take persistence from dashPersistence on element
1 parent a1f6b5e commit 6af9973

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

components/dash-core-components/src/components/Textarea.react.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ const Textarea = ({
4242
n_blur_timestamp = -1,
4343
n_clicks,
4444
n_clicks_timestamp = -1,
45-
persisted_props = ['value'],
46-
persistence_type = 'local',
45+
persisted_props,
46+
persistence_type,
4747
...props
4848
}) => {
4949
const ctx = window.dash_component_api.useDashContext();
@@ -73,6 +73,11 @@ const Textarea = ({
7373
);
7474
};
7575

76+
Textarea.dashPersistence = {
77+
persisted_props: ['value'],
78+
persistence_type: 'local',
79+
};
80+
7681
Textarea.propTypes = {
7782
/**
7883
* The ID of this component, used to identify dash components

dash/dash-renderer/src/persistence.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,9 @@ const getProps = layout => {
290290
const {id, persistence} = props;
291291

292292
const element = Registry.resolve(layout);
293-
const getVal = prop => props[prop] || (element.defaultProps || {})[prop];
293+
const getVal = prop =>
294+
props[prop] ||
295+
(element.defaultProps || element.dashPersistence || {})[prop];
294296
const persisted_props = getVal('persisted_props');
295297
const persistence_type = getVal('persistence_type');
296298
const canPersist = id && persisted_props && persistence_type;

0 commit comments

Comments
 (0)