From 65cf22c44072b3b8eb225be1fcf4fa0f915ec58c Mon Sep 17 00:00:00 2001 From: Nikolai Mavrenkov Date: Thu, 10 Jan 2019 01:08:07 +0300 Subject: [PATCH] issues/3 --- app/components/App/index.tsx | 2 ++ app/components/Header/index.tsx | 5 +++-- app/components/Tab/index.tsx | 2 +- app/services/browser.ts | 7 ++----- app/types.ts | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/components/App/index.tsx b/app/components/App/index.tsx index 40b5621..30a0f83 100644 --- a/app/components/App/index.tsx +++ b/app/components/App/index.tsx @@ -64,6 +64,8 @@ export default class extends Component { updateTabs() { Browser.getCurrentSession().then((session) => { this.setState({ session }) + }).catch((e) => { + console.error(`Unable to get current session`, e); }) } diff --git a/app/components/Header/index.tsx b/app/components/Header/index.tsx index 7361b6e..373889f 100644 --- a/app/components/Header/index.tsx +++ b/app/components/Header/index.tsx @@ -1,7 +1,8 @@ -import { h, Component } from 'preact'; -import {ISavedSession, ISavedSessionHeader, ITab, IWindow} from "../../types"; +import {Component, h} from 'preact'; +import {ISavedSessionHeader, IWindow} from "../../types"; import cn from 'classnames'; import plural from "../../helpers/plural"; + const styles = require('./index.less'); export type UITab = 'CURRENT' | 'SAVED'; diff --git a/app/components/Tab/index.tsx b/app/components/Tab/index.tsx index 6eb1415..0cfb669 100644 --- a/app/components/Tab/index.tsx +++ b/app/components/Tab/index.tsx @@ -36,7 +36,7 @@ export default class extends Component { href={tab.url} title={tab.url} > - {tab.title} + {tab.title || ''} {onClose && } diff --git a/app/services/browser.ts b/app/services/browser.ts index 6a98f02..f82f880 100644 --- a/app/services/browser.ts +++ b/app/services/browser.ts @@ -347,17 +347,14 @@ const ProductionBrowser: IBrowser = { } if (window.tabs !== null && window.tabs !== undefined) { - tabs = window.tabs.map(({id, windowId, active, url, title, favIconUrl, pinned}): ITab => { + tabs = window.tabs.map(({ id, windowId, active, url, title, favIconUrl, pinned }): ITab => { if (id === null || id === undefined) { throw new Error(`This extension doesn't support tabs with null id's. This should actually never happen`) } if (url === null || url === undefined) { throw new Error(`URL should not be null, since we require 'tabs' permission`) } - if (title === null || title === undefined) { - throw new Error(`URL should not be null, since we require 'tabs' permission`) - } - return {id, windowId, active, url, title, favIconUrl: favIconUrl || null, pinned}; + return {id, windowId, active, url, title: title || null, favIconUrl: favIconUrl || null, pinned}; }); } else { console.error(`windows.tabs should never be null, since we use "populate: true" option`); diff --git a/app/types.ts b/app/types.ts index 21586b9..ba862db 100644 --- a/app/types.ts +++ b/app/types.ts @@ -45,7 +45,7 @@ export interface INewTab { // microphone: boolean // }, url: string, - title: string, + title: string | null, favIconUrl: string | null, }