CATcher-org / CATcher-org/WATcher
Reading property of `undefined` when switching repo in activity dashboard
- Dominant language
- TypeScript
- Stars
- 10
- Forks
- 38
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Cannot read property of `undefined` (reading 'id')
**To Reproduce**
Steps to reproduce the behavior:
1. Go to activity dashboard.
2. Switch to another repo within activity dashboard.
Note that no activity shows up. However, this is not observed with the following steps:
1. Go to activity dashboard.
2. Switch to issues viewer.
3. Switch back to activity dashboard.
Some activity shows up.
**Expected behavior**
There should not be any bug as described.
**Screenshots**

**Desktop (please complete the following information):**
- OS: Window 10
- Browser: chrome
- Version: 1.1.0
**Additional context**
This might be due to unnecessary call to `issueService`. The line occurs in `issueService::updateLocalStore` method:
```ts
private updateLocalStore(issuesToUpdate: Issue[]) {
const newIssues = { ...this.issues };
issuesToUpdate.forEach((issue) => {
newIssues[issue.id] = issue;
});
this.issues = newIssues;
this.issues$.next(Object.values(this.issues));
}
```
The given `issuesToUpdate` parameter is an array of `undefined`s, i.e. `[undefined, undefined, ...]`
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the activity dashboard repo-switch flow and the issueService::updateLocalStore method described in the report. Reproduce switching repositories directly from the activity dashboard, then trace why the update receives undefined entries. Done means the error no longer occurs and activity appears after switching repositories; verify the alternate dashboard navigation still works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100