-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement tests sorting #621
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
lib/static/new-ui/features/suites/components/SuitesTreeView/utils.ts
Outdated
Show resolved
Hide resolved
lib/static/new-ui/features/suites/components/SuitesTreeView/utils.ts
Outdated
Show resolved
Hide resolved
}; | ||
|
||
return sortAndGetWeight(treeNodes).sortedTreeNodes; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a little bit complicated logic here, but i don't how it makes simpler. Just a lot of cases which should be covered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, so I once again looked at the code and tried to simplify it. What's came out of this:
- There is no referring to magic indexes like [0], [1] anymore, I introduced weight metadata instead, which is type-safe and more explicit & readable
- Got rid of duplicating logic related to adding tags, and the code's become a lot cleaner
The file is still pretty large, but more readable and clear.
const treeNodesCopy = treeNodes.slice(0); | ||
const weights: Record<string, TreeNodeWeight> = {}; | ||
|
||
treeNodesCopy.forEach((treeNode, index) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hard core =)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree! So I decided to fix it. Replied here: #621 (comment)
c27ee15
to
117a268
Compare
What's done
Demo report: https://nda.ya.ru/t/r_tGtS0S7A9u5q