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