Skip to content

Commit

Permalink
Handle calculateFrequency edge case
Browse files Browse the repository at this point in the history
Explicitly handle the case where `time` is undefined due to the user
upgrading their version of Gutenberg.
  • Loading branch information
noisysocks committed Mar 8, 2018
1 parent 8f07c80 commit a43d609
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions editor/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,10 @@ function getItemsFromInserts( state, inserts, enabledBlockTypes = true, maximum
*/
export function getFrecentInserterItems( state, enabledBlockTypes = true, maximum = MAX_RECENT_BLOCKS ) {
const calculateFrecency = ( time, count ) => {
if ( ! time ) {
return count;
}

const duration = Date.now() - time;
switch ( true ) {
case duration < 3600:
Expand Down

0 comments on commit a43d609

Please sign in to comment.