lucaseverett/easy-speed-dial

Blank screen on startup

Closed this issue · 2 comments

Issue

Extensions shows a blank screen on new tab page. Dev console contains this error:
19:11:12.883 TypeError: (destructured parameter) is undefined[Learn More] 4ea671bc80236735c193cd5c78acf6e3.js:1634:1

Cause

The error occurs here:

https://github.com/lucaseverett/Firefox-Toolbar-Dial/blob/80c1d339a53a5c526114e4c58522d92e819bdd47/src/components/index.js#L14

But truly it is caused here:

https://github.com/lucaseverett/Firefox-Toolbar-Dial/blob/80c1d339a53a5c526114e4c58522d92e819bdd47/src/store.js#L8-L12

Map function doesn't filter out not returned values, it just returns an implicit undefined. Thus if retrieved bookmarks contains folders or place: urls, your bookmark array becomes filled with undefined values. The previous line tries to destructure an undefined value, and errors out.

Fix

My solution would be to filter the array to get rid of unwanted values and then map over it to transform.

BTW, at least in Firefox bookmarks can contain another type called 'separator', which you probably also do not want to display.

Great feedback. Yeah, I should filter first before map. I'll update this and upload fix soon.

Commit c5b3485 fixes #1