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

Properly display about:newtab when session is null #5411

Merged
merged 1 commit into from
Nov 4, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions js/about/newtab.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,20 @@ class NewTabPage extends React.Component {
updatedStamp: undefined
}
ipc.on(messages.NEWTAB_DATA_UPDATED, (e, newTabData) => {
this.sanitize(newTabData)
})
}
sanitize (newTabData) {
let sanitizedData = Immutable.fromJS(newTabData || {})
const updatedStamp = sanitizedData.getIn(['newTabDetail', 'updatedStamp'])

// Only update if the data has changed.
if (updatedStamp === this.state.updatedStamp) {
return
}
const data = Immutable.fromJS(newTabData || {})
const updatedStamp = data.getIn(['newTabDetail', 'updatedStamp'])

// Only update if the data has changed.
if (typeof updatedStamp === 'number' &&
typeof this.state.updatedStamp === 'number' &&
updatedStamp === this.state.updatedStamp) {
return
}

this.setState({
newTabData: sanitizedData,
updatedStamp: updatedStamp
this.setState({
newTabData: data,
updatedStamp: updatedStamp
})
})
}

Expand Down