Commit bd6d0ce8 authored by Fatih Acet's avatar Fatih Acet

Merge branch '24836-tyeerror-e-is-null-when-clicking-plan-tab-in-cycle-analytics' into 'master'

Pick valid event objects for the events list

## What does this MR do?
Fixes JS error when loading events with possible `null` objects

## What are the relevant issue numbers?
Closes #24836

See merge request !7689
parents 858602ea 0a1f519c
...@@ -62,9 +62,11 @@ ...@@ -62,9 +62,11 @@
this.state.events = this.decorateEvents(events); this.state.events = this.decorateEvents(events);
}, },
decorateEvents(events) { decorateEvents(events) {
const newEvents = events; const newEvents = [];
events.forEach((item) => {
if (!item) return;
newEvents.forEach((item) => {
item.totalTime = item.total_time; item.totalTime = item.total_time;
item.author.webUrl = item.author.web_url; item.author.webUrl = item.author.web_url;
item.author.avatarUrl = item.author.avatar_url; item.author.avatarUrl = item.author.avatar_url;
...@@ -79,6 +81,8 @@ ...@@ -79,6 +81,8 @@
delete item.created_at; delete item.created_at;
delete item.short_sha; delete item.short_sha;
delete item.commit_url; delete item.commit_url;
newEvents.push(item);
}); });
return newEvents; return newEvents;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment