diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-11-24 16:32:22 +0000 |
---|---|---|
committer | Alejandro RodrÃguez <alejorro70@gmail.com> | 2016-12-01 12:40:50 -0300 |
commit | deeae06011de73492f7bec64865d00b5054990f4 (patch) | |
tree | 16a455c77cff0210d42c20e82c9bdb06fb4739b3 | |
parent | f187ecbd46e96960ef06a2132a2c59145f5ca83b (diff) | |
download | gitlab-ce-deeae06011de73492f7bec64865d00b5054990f4.tar.gz |
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
-rw-r--r-- | app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6 | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6 b/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6 index 9b905874167..be732971c7f 100644 --- a/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6 +++ b/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6 @@ -62,9 +62,11 @@ this.state.events = this.decorateEvents(events); }, decorateEvents(events) { - const newEvents = events; + const newEvents = []; + + events.forEach((item) => { + if (!item) return; - newEvents.forEach((item) => { item.totalTime = item.total_time; item.author.webUrl = item.author.web_url; item.author.avatarUrl = item.author.avatar_url; @@ -79,6 +81,8 @@ delete item.created_at; delete item.short_sha; delete item.commit_url; + + newEvents.push(item); }); return newEvents; |