Developers, SW: check 'waiting' before 'active'
This commit is contained in:
parent
66cd92970b
commit
d385c0d80c
1 changed files with 10 additions and 10 deletions
|
@ -50,10 +50,10 @@ const ServiceWorkerInfo: React.FC<IServiceWorkerInfo> = () => {
|
|||
const url = registration?.active?.scriptURL;
|
||||
|
||||
const getState = () => {
|
||||
if (registration?.active) {
|
||||
return 'active';
|
||||
} else if (registration?.waiting) {
|
||||
if (registration?.waiting) {
|
||||
return 'pending';
|
||||
} else if (registration?.active) {
|
||||
return 'active';
|
||||
} else {
|
||||
return 'inactive';
|
||||
}
|
||||
|
@ -74,13 +74,6 @@ const ServiceWorkerInfo: React.FC<IServiceWorkerInfo> = () => {
|
|||
defaultMessage='Unavailable'
|
||||
/>
|
||||
);
|
||||
} else if (registration?.active) {
|
||||
return (
|
||||
<FormattedMessage
|
||||
id='sw.state.active'
|
||||
defaultMessage='Active'
|
||||
/>
|
||||
);
|
||||
} else if (registration?.waiting) {
|
||||
return (
|
||||
<FormattedMessage
|
||||
|
@ -88,6 +81,13 @@ const ServiceWorkerInfo: React.FC<IServiceWorkerInfo> = () => {
|
|||
defaultMessage='Waiting'
|
||||
/>
|
||||
);
|
||||
} else if (registration?.active) {
|
||||
return (
|
||||
<FormattedMessage
|
||||
id='sw.state.active'
|
||||
defaultMessage='Active'
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<FormattedMessage
|
||||
|
|
Loading…
Reference in a new issue