Skip to content

Commit e0fc8b4

Browse files
authored
fix: fix order story
1 parent b25d9e9 commit e0fc8b4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

stories/add_remove/controllable-order.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ export default class ControllableOrder extends React.Component {
3030
}
3131

3232
add() {
33-
const order = [String(this.id), ...this.state.order];
33+
const pos = ~~(Math.random() * this.state.list.length);
34+
const order = [...this.state.order];
35+
order.splice(pos, 0, String(this.id));
3436
this.state.list.splice(
35-
~~(Math.random() * this.state.list.length),
37+
pos,
3638
0,
3739
<Pane key={this.id} defaultSize={{ width: '100%', height: 120 }} style={paneStyle}>
3840
<p style={textStyle}>00{this.id++}</p>

0 commit comments

Comments
 (0)