CATcher-org / CATcher-org/WATcher

Reading property of `undefined` when switching repo in activity dashboard

Open
#287 0 comments 0 reactions 0 assignees View on GitHub
category.Bug
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**
![image](https://github.com/CATcher-org/WATcher/assets/87511888/fdefe685-6712-462e-9427-29973db4854d)

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.