Skip to content

Commit 2e13905

Browse files
authored
Merge pull request #32512 from takashi-kasajima/fix/json-array-add-value
Controls: Fix adding new values to arrays
2 parents ab386d7 + 50afef0 commit 2e13905

File tree

1 file changed

+2
-1
lines changed
  • code/addons/docs/src/blocks/controls/react-editable-json-tree

1 file changed

+2
-1
lines changed

code/addons/docs/src/blocks/controls/react-editable-json-tree/JsonNodes.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,10 @@ export class JsonArray extends Component<JsonArrayProps, JsonArrayState> {
252252
};
253253
}
254254

255-
handleAddValueAdd({ key, newValue }: any) {
255+
handleAddValueAdd({ newValue }: any) {
256256
const { data, keyPath = [], nextDeep: deep } = this.state;
257257
const { beforeAddAction, logger } = this.props;
258+
const key = data.length;
258259

259260
(beforeAddAction || Promise.resolve.bind(Promise))(key, keyPath, deep, newValue)
260261
.then(() => {

0 commit comments

Comments
 (0)