-
Notifications
You must be signed in to change notification settings - Fork 360
Fixed the "Show More" button issue in the subject details page where the button was not responding correctly when clicked. #2499
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
base: main
Are you sure you want to change the base?
Conversation
|
这个居然不是服务器问题吗 |
好像确实,服务端返回tag不够 |
|
看了下服务端代码, tags 应该是全的 (全部读了 bangumi archive 给的 tags) mapping 全都是 1:1 的 |
app/shared/ui-subject/src/commonMain/kotlin/ui/subject/details/components/DetailsTab.kt
Show resolved
Hide resolved
|
感觉提 issue 的人可能是想展开介绍部分而不是 tag 列表 |
| isExpanded -> allTags | ||
| allTags.size <= 6 -> allTags | ||
| else -> { | ||
| val filteredByCount = allTags.filter { it.count > 100 } | ||
| if (filteredByCount.size < ALWAYS_SHOW_TAGS_COUNT) { | ||
| allTags.take(ALWAYS_SHOW_TAGS_COUNT) | ||
| } else { | ||
| if (filteredByCount.size <= ALWAYS_SHOW_TAGS_COUNT) { | ||
| filteredByCount | ||
| } else { | ||
| allTags.take(ALWAYS_SHOW_TAGS_COUNT) | ||
| } |
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.
感觉可以把这部分逻辑抽出来跟上面是否显示 hasMore 的逻辑匹配上,比如
val collapsedTags by remember { derivedStateOf { xxx } }
val hasMoreTags by remember { derivedStateOf { collapsedTags.size < allTags.size } }
我这里log发现所有剧集的tags的数量都是11个,感觉可能是是服务端问题 看了下接口确实只返回11个 "tags": [
{
"name": "搞笑",
"count": 4821
},
{
"name": "颜艺",
"count": 2670
},
{
"name": "漫画改",
"count": 2348
},
{
"name": "2018年7月",
"count": 1666
},
{
"name": "A-1Pictures",
"count": 1479
},
{
"name": "TV",
"count": 1381
},
{
"name": "碧蓝之海",
"count": 1001
},
{
"name": "日常",
"count": 991
},
{
"name": "漫改",
"count": 986
},
{
"name": "爆笑",
"count": 956
},
{
"name": "2018",
"count": 755
}
]对比完整tags,猜测为服务端过滤了小于100的tag |
|
确定是bangumi archive只给了11个tag,他们不太愿意给更多tags |
|
那现在是否还需要“显示更多”,感觉可以去掉了 |
|
可以想办法在服务端 workaround 其实 |
What
Fixed the "Show More" button issue in subject details page tags section.
Why
The button was not responding correctly due to incorrect logic in presentTags computation using hardcoded values instead of
ALWAYS_SHOW_TAGS_COUNTconstant.Where
In the TagsList composable component in
DetailsTab.ktfile.Related
Closes #2498