Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Revert fa919c0
Browse files Browse the repository at this point in the history
Fixes #8294
Unfixes #7765
  • Loading branch information
bsclifton committed Apr 18, 2017
1 parent d7e5824 commit 8d2f98f
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions js/components/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,26 +99,12 @@ class Tab extends ImmutableComponent {
return locale.translation('newTab')
}

// NOTE(bsclifton): this can't use a simple falsey check with fallback values
// since properties are involved. I believe the title is populated page is loaded
// (which means it uses location first). When title is truthy, React gets confused
// and renders the location (but shows the title in the DOM). This may be a bug in React.
//
// Here's a demo of the syntax which causes the problem:
// return this.props.tab.get('title') || this.props.tab.get('location') || ''

const title = this.props.tab && this.props.tab.get('title')
const location = this.props.tab && this.props.tab.get('location')
const display = typeof title === 'undefined'
? typeof location === 'undefined'
? ''
: location
: title

// YouTube tries to change the title to add a play icon when
// there is audio. Since we have our own audio indicator we get
// rid of it.
return display.replace('▶ ', '')
return (this.props.tab.get('title') ||
this.props.tab.get('location') ||
'').replace('▶ ', '')
}

onDragStart (e) {
Expand Down

0 comments on commit 8d2f98f

Please sign in to comment.