querysub 0.261.0 → 0.262.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -67,12 +67,13 @@ function onLiveHashChange(liveHash: string, refreshThresholdTime: number) {
|
|
|
67
67
|
// Start notification loop
|
|
68
68
|
void (async () => {
|
|
69
69
|
// Show notifications at intervals
|
|
70
|
-
for (let i = 0; i < notifyIntervals.length; i++) {
|
|
70
|
+
for (let i = 0; i < notifyIntervals.length - 1; i++) {
|
|
71
71
|
// Don't show if a newer notification is active
|
|
72
72
|
if (curHash !== liveHash) return;
|
|
73
73
|
|
|
74
74
|
let waitDuration = (notifyIntervals[i + 1] - notifyIntervals[i]) * refreshThresholdTime;
|
|
75
|
-
|
|
75
|
+
// If the duration is short, and it's not the last one, skip it
|
|
76
|
+
if (i < notifyIntervals.length - 2 && waitDuration <= 30 * 1000) continue;
|
|
76
77
|
|
|
77
78
|
// Update the URL override for manual refreshes
|
|
78
79
|
Querysub.localCommit(() => {
|
|
@@ -92,11 +93,14 @@ function onLiveHashChange(liveHash: string, refreshThresholdTime: number) {
|
|
|
92
93
|
.bottom(10)
|
|
93
94
|
.right(10)
|
|
94
95
|
.zIndex(1000)
|
|
96
|
+
+ " keepModalsOpen"
|
|
95
97
|
}
|
|
96
98
|
>
|
|
97
99
|
<div className={css.vbox(10).maxWidth(250)}>
|
|
98
100
|
<h3 className={css.margin(0)}>Server Update Available</h3>
|
|
99
101
|
<div>The server has been updated. Please refresh the page to ensure you don't experience incompatibility issues.</div>
|
|
102
|
+
{i !== notifyIntervals.length - 2 && <div>This notification will be shown again in {formatTime(waitDuration)}</div>}
|
|
103
|
+
{i === notifyIntervals.length - 2 && <div>The page will automatically refresh in {formatTime(waitDuration)}</div>}
|
|
100
104
|
</div>
|
|
101
105
|
<div className={css.hbox(10).justifyContent("flex-end")}>
|
|
102
106
|
<button
|
|
@@ -133,9 +137,6 @@ function onLiveHashChange(liveHash: string, refreshThresholdTime: number) {
|
|
|
133
137
|
await delay(waitDuration);
|
|
134
138
|
}
|
|
135
139
|
|
|
136
|
-
console.log(red(`Force refresh after 30 seconds`));
|
|
137
|
-
await delay(30 * 1000);
|
|
138
|
-
|
|
139
140
|
// Only force refresh if this is still the current notification
|
|
140
141
|
if (curHash === liveHash) {
|
|
141
142
|
window.location.reload();
|