Skip to content

Commit

Permalink
fix: zset delete wrong element when sorting desc
Browse files Browse the repository at this point in the history
Closes #60
  • Loading branch information
luin committed Feb 18, 2017
1 parent 3599392 commit 3d3f29a
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ class ZSetContent extends BaseContent {
content: 'Are you sure you want to delete the selected item? This action cannot be undone.'
}).then(() => {
const members = this.state.members;
const deleted = members.splice(this.state.selectedIndex, 1);
const index = this.state.desc ? this.state.length - 1 - this.state.selectedIndex : this.state.selectedIndex;
const deleted = members.splice(index, 1);
if (deleted.length) {
this.props.redis.zrem(this.state.keyName, deleted[0]);
if (this.state.selectedIndex >= members.length - 1) {
Expand Down

0 comments on commit 3d3f29a

Please sign in to comment.