Skip to content

Commit 3d3f29a

Browse files
committed
fix: zset delete wrong element when sorting desc
Closes #60
1 parent 3599392 commit 3d3f29a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

client/components/main/Main/Database/Content/KeyContent/ZSetContent.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ class ZSetContent extends BaseContent {
100100
content: 'Are you sure you want to delete the selected item? This action cannot be undone.'
101101
}).then(() => {
102102
const members = this.state.members;
103-
const deleted = members.splice(this.state.selectedIndex, 1);
103+
const index = this.state.desc ? this.state.length - 1 - this.state.selectedIndex : this.state.selectedIndex;
104+
const deleted = members.splice(index, 1);
104105
if (deleted.length) {
105106
this.props.redis.zrem(this.state.keyName, deleted[0]);
106107
if (this.state.selectedIndex >= members.length - 1) {

0 commit comments

Comments
 (0)