[BUG]: Organization filter dropdown in AnalyticsPage renders empty list due to truthy evaluation of empty issuesData

未关闭 适合新手
#476 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@havyasreekuppam 已经在做这个了。

开始于 2026年11月22日。

  • #477 来自 @shreyapatil22-hub —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
javascript, react
领域
frontend

调研方向

allOrgs 的三元表达式位于 src/pages/AnalyticsPage.jsx 的第 32 行,issuesData 在 src/AppContext.jsx 中初始化为 {}。请阅读该三元表达式以及两个标签为"按组织筛选统计数据"的 select 元素,然后运行 src/pages/AnalyticsPage.dropdown.test.jsx。当 issuesData 为空时,下拉列表能列出 pullsData 中的组织,并且 issuesData 有数据的情况仍然正常,即视为完成。

由索引模型根据 Issue 内容生成。

描述

bug
Bug Description

In src/pages/AnalyticsPage.jsx (line 32), the organization filter dropdown list (allOrgs) is computed via:

const allOrgs = issuesData ? [...new Set((Object.keys(issuesData)).map(k => k.split('/')[0]))] : [...new Set((Object.keys(pullsData)).map(k => k.split('/')[0]))];

When a user explores organizations and navigates to the Analytics page, issuesData is initialized as an empty object {} in AppContext.jsx (line 22):

const [issuesData, setIssuesData] = useState({})

In JavaScript, an empty object is truthy (Boolean({}) === true). Consequently, the ternary expression unconditionally selects the issuesData branch, evaluating Object.keys({}) which produces [].

The intended fallback to pullsData is completely unreachable dead code. As a result, both the Activity Trends and Advanced Analytics organization filter dropdowns (<select aria-label="Filter stats by organization">) render only <option>All Organizations</option> with zero selectable organizations, preventing users from filtering analytics by organization even when multiple organizations with valid pull requests are loaded.

Steps to Reproduce
  1. Navigate to the Home page and explore one or more organizations (e.g. AOSSIE-Org, Google).
  2. Navigate to the Analytics page (/analytics).
  3. Click on the organization filter dropdown in either the Activity Trends section or the Advanced Analytics section.
  4. Notice that only "All Organizations" is displayed; no individual organizations appear in the dropdown list despite pull request data having been loaded.
Logs and Screenshots

Component test output verifying the bug:

stdout | src/pages/AnalyticsPage.dropdown.test.jsx > AnalyticsPage Organization Filter Dropdown
[FAILURE TEST] Rendered select options with initial issuesData={}: [ 'All Organizations' ]
[CONTROL TEST] Rendered select options with populated issuesData: [ 'All Organizations', 'AOSSIE-Org', 'Google' ]

JSON state representation:

{
  "issuesData": {},
  "pullsData": {
    "AOSSIE-Org/OrgExplorer": [{ "id": 1 }],
    "Google/guava": [{ "id": 2 }]
  },
  "allOrgs": []
}
Environment Details
  • OS: Windows 11 / Linux / macOS
  • Browser: Chrome / Firefox / Safari / Edge
  • Node.js: v20+ / v22+
  • Commit: b396d1b7f50a3341d4a5b9ff67211d95c9a5fb95 (main)
Impact

High - Major feature is broken (Organization filtering is non-functional across Analytics pages)

Code of Conduct
  • I have joined the Discord server and will post updates there
  • I have searched existing issues to avoid duplicates
主要语言
JavaScript
星标
53
派生
187
平均合并
18 分钟
30 天内合并 PR
2

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AOSSIE-Org/OrgExplorer 的其他 Issue

查看 AOSSIE-Org/OrgExplorer 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。