mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-26 11:15:43 +03:00
Add ability to reload hero status
This commit is contained in:
parent
a3ea2cb752
commit
f4310ad8e4
1 changed files with 5 additions and 3 deletions
|
@ -78,7 +78,7 @@ function StatusPage() {
|
||||||
}, [id, uiState !== 'loading']);
|
}, [id, uiState !== 'loading']);
|
||||||
|
|
||||||
const scrollOffsets = useRef();
|
const scrollOffsets = useRef();
|
||||||
const initContext = () => {
|
const initContext = ({ reloadHero } = {}) => {
|
||||||
console.debug('initContext', id);
|
console.debug('initContext', id);
|
||||||
setUIState('loading');
|
setUIState('loading');
|
||||||
let heroTimer;
|
let heroTimer;
|
||||||
|
@ -114,7 +114,7 @@ function StatusPage() {
|
||||||
|
|
||||||
const hasStatus = !!snapStates.statuses[sKey];
|
const hasStatus = !!snapStates.statuses[sKey];
|
||||||
let heroStatus = snapStates.statuses[sKey];
|
let heroStatus = snapStates.statuses[sKey];
|
||||||
if (hasStatus) {
|
if (hasStatus && !reloadHero) {
|
||||||
console.debug('Hero status is cached');
|
console.debug('Hero status is cached');
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
@ -277,7 +277,9 @@ function StatusPage() {
|
||||||
const apiCache = await caches.open('api');
|
const apiCache = await caches.open('api');
|
||||||
await apiCache.delete(contextURL, { ignoreVary: true });
|
await apiCache.delete(contextURL, { ignoreVary: true });
|
||||||
|
|
||||||
return initContext();
|
return initContext({
|
||||||
|
reloadHero: true,
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue