From 02dfcc3cf7e4e7ca56cd455802fcb4df72a6da62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Wed, 4 Sep 2019 10:50:59 -0700 Subject: [PATCH] FliterToken Summary: fixing ts-strict errors Reviewed By: jknoxville Differential Revision: D17181141 fbshipit-source-id: c6c70ed2e76fbe4a3e7ee807ef1e2de2dad3eb55 --- src/ui/components/searchable/FilterToken.tsx | 21 +++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/ui/components/searchable/FilterToken.tsx b/src/ui/components/searchable/FilterToken.tsx index 641e97a8f..fbf3f92f9 100644 --- a/src/ui/components/searchable/FilterToken.tsx +++ b/src/ui/components/searchable/FilterToken.tsx @@ -151,15 +151,17 @@ export default class FilterToken extends PureComponent { ); } const menu = electron.remote.Menu.buildFromTemplate(menuTemplate); - const {bottom, left} = this._ref.getBoundingClientRect(); + if (this._ref) { + const {bottom, left} = this._ref.getBoundingClientRect(); - menu.popup({ - window: electron.remote.getCurrentWindow(), - // @ts-ignore: async is private API - async: true, - x: left, - y: bottom + 8, - }); + menu.popup({ + window: electron.remote.getCurrentWindow(), + // @ts-ignore: async is private API + async: true, + x: left, + y: bottom + 8, + }); + } }; toggleFilter = () => { @@ -207,7 +209,8 @@ export default class FilterToken extends PureComponent { let value = ''; if (filter.type === 'enum') { - const getEnum = value => filter.enum.find(e => e.value === value); + const getEnum = (value: string) => + filter.enum.find(e => e.value === value); const firstValue = getEnum(filter.value[0]); const secondValue = getEnum(filter.value[1]); if (filter.value.length === 0) {