Skip to content

Commit

Permalink
When in the 'compare' view we should see the service worker reload no…
Browse files Browse the repository at this point in the history
…tification (PR firefox-devtools#2147)
  • Loading branch information
julienw authored Jul 12, 2019
1 parent 74410df commit e31f36c
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/components/app/ServiceWorkerManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import React, { PureComponent } from 'react';
import explicitConnect from '../../utils/connect';
import { assertExhaustiveCheck } from '../../utils/flow';

import { getDataSource } from '../../selectors/url-state';
import { getView } from '../../selectors/app';
Expand Down Expand Up @@ -99,12 +100,21 @@ class ServiceWorkerManager extends PureComponent<Props, State> {
const { dataSource } = this.props;
const { installStatus, isNoticeDisplayed } = this.state;

if (
dataSource !== 'none' &&
dataSource !== 'public' &&
dataSource !== 'from-url'
) {
return null;
switch (dataSource) {
case 'from-file':
case 'from-addon':
// We should not propose to reload the page for these data sources,
// because we'd lose the data.
return null;
case 'none':
case 'public':
case 'from-url':
case 'compare':
case 'local':
// But for these data sources it should be fine.
break;
default:
throw assertExhaustiveCheck(dataSource);
}

if (installStatus !== 'ready') {
Expand Down

0 comments on commit e31f36c

Please sign in to comment.