feat: The order of the category operator form is messed up after refreshing the page #3088 (#3089)

### What problem does this PR solve?

feat: The order of the category operator form is messed up after
refreshing the page #3088

### Type of change

- [ ] Bug Fix (non-breaking change which fixes an issue)
- [x] New Feature (non-breaking change which adds functionality)
- [ ] Documentation Update
- [ ] Refactoring
- [ ] Performance Improvement
- [ ] Other (please describe):
This commit is contained in:
balibabu
2024-10-29 19:21:52 +08:00
committed by GitHub
parent c7dfb0193b
commit d868c283c4
4 changed files with 25 additions and 12 deletions

View File

@@ -29,13 +29,15 @@ export const useBuildCategorizeHandlePositions = ({
idx: number;
}> = [];
Object.keys(categoryData).forEach((x, idx) => {
list.push({
text: x,
idx,
top: idx === 0 ? 98 : list[idx - 1].top + 8 + 26,
Object.keys(categoryData)
.sort((a, b) => categoryData[a].index - categoryData[b].index)
.forEach((x, idx) => {
list.push({
text: x,
idx,
top: idx === 0 ? 98 : list[idx - 1].top + 8 + 26,
});
});
});
return list;
}, [categoryData]);