Skip to content

Commit 6cefd88

Browse files
committed
a different approach for TS compile issues
1 parent 0fab9a1 commit 6cefd88

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

@plotly/dash-generator-test-component-typescript/src/props.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
// Needs to export types if not in a d.ts file or if any import is present in the d.ts
22
import React from 'react';
3-
import {DashComponent} from '@dash-renderer/types';
3+
4+
type DashComponent = {
5+
props: string;
6+
namespace: string;
7+
children?: [];
8+
}
49

510

611
type Nested = {

@plotly/dash-generator-test-component-typescript/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"jsx": "react",
44
"baseUrl": "src/ts",
55
"paths": {
6-
"@dash-renderer/*": ["../../../../dash/dash-renderer/src/*"]
76
},
87
"inlineSources": true,
98
"sourceMap": true,

components/dash-core-components/src/components/Tabs.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ function Tabs({
121121
const firstChildren: TabProps = window.dash_component_api.getLayout(
122122
[...children[0].props.componentPath, 'props']
123123
);
124-
return firstChildren.value;
124+
return firstChildren.value ?? 'tab-1';
125125
}
126-
return undefined;
126+
return 'tab-1';
127127
};
128128

129129
// Initialize value on mount if not set
@@ -271,7 +271,11 @@ function Tabs({
271271
);
272272
}
273273

274-
Tabs.dashPersistence = true;
274+
Tabs.dashPersistence = {
275+
persisted_props: [PersistedProps.value],
276+
persistence_type: PersistenceTypes.local,
277+
};
278+
275279
Tabs.dashChildrenUpdate = true;
276280

277281
export default Tabs;

dash/dash-renderer/src/wrapper/DashWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ function DashWrapper({
391391

392392
if (node !== undefined) {
393393
if (isArray) {
394-
for (let j = 0; j < (node as []).length; j++) {
394+
for (let j = 0; j < node.length; j++) {
395395
const aPath = concat([opath], [j]);
396396
props = assocPath(
397397
aPath,

0 commit comments

Comments
 (0)