Skip to content

Conversation

@GeneralK1ng
Copy link
Member

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_COUNT constant.

Where

In the TagsList composable component in DetailsTab.kt file.

Related

Closes #2498

@StageGuard StageGuard enabled auto-merge (squash) September 17, 2025 08:03
@Him188
Copy link
Member

Him188 commented Sep 17, 2025

这个居然不是服务器问题吗

@GeneralK1ng
Copy link
Member Author

这个居然不是服务器问题吗

好像确实,服务端返回tag不够

@StageGuard StageGuard disabled auto-merge September 17, 2025 12:52
@Him188
Copy link
Member

Him188 commented Sep 17, 2025

看了下服务端代码, tags 应该是全的 (全部读了 bangumi archive 给的 tags)

mapping 全都是 1:1 的

@Mystery406
Copy link
Contributor

感觉提 issue 的人可能是想展开介绍部分而不是 tag 列表

Comment on lines -270 to 276
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)
}
Copy link
Contributor

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 } }

@GeneralK1ng
Copy link
Member Author

GeneralK1ng commented Sep 18, 2025

看了下服务端代码, tags 应该是全的 (全部读了 bangumi archive 给的 tags)

我这里log发现所有剧集的tags的数量都是11个,感觉可能是是服务端问题

2025-09-18 22:43:21.044 17224-17271 SubjectCol...sitory.ext me.him188.ani.debug2                 I  subjectId=506677: Repository toEntity - 原始tags=11个, tags=2025年7月:1151, 奇幻:958, 轻小说改:795, 校园:673, TV:653, A-1Pictures:512, Studio五组:494, 小说改:426, 2025:416, 日本:398, 轻改:289
2025-09-18 22:43:21.054 17224-17271 SubjectCol...sitory.ext me.him188.ani.debug2                 I  subjectId=363957: Repository toEntity - 原始tags=11个, tags=GAL改:2249, key:1894, 恋爱:1586, 2025年4月:1456, 游戏改:1248, TV:1204, Feel.:1135, 麻枝准:902, 治愈:709, 2025:594, 日本:552
2025-09-18 22:43:21.054 17224-17271 SubjectCol...sitory.ext me.him188.ani.debug2                 I  subjectId=514358: Repository toEntity - 原始tags=11个, tags=京阿尼:1638, 日常:1280, 2025年7月:1265, 漫画改:1128, TV:1003, 搞笑:762, 京都动画:627, 2025:575, 石立太一:524, 日本:481, 漫改:399
2025-09-18 22:43:21.055 17224-17271 SubjectCol...sitory.ext me.him188.ani.debug2                 I  subjectId=477825: Repository toEntity - 原始tags=11个, tags=GAL改:1778, 2025年7月:1393, 搞笑:1297, 游戏改:1174, 抽象:1104, TV:1081, Passione:690, 校园:687, 日本:669, 恋爱:478, 2025:461

看了下接口确实只返回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

@Him188
Copy link
Member

Him188 commented Sep 28, 2025

确定是bangumi archive只给了11个tag,他们不太愿意给更多tags

@GeneralK1ng
Copy link
Member Author

GeneralK1ng commented Oct 6, 2025

那现在是否还需要“显示更多”,感觉可以去掉了

@Him188
Copy link
Member

Him188 commented Oct 6, 2025

可以想办法在服务端 workaround 其实

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5.0.0-beta2版本点击“显示更多”之后无法展开

5 participants