Merge pull request #918 from timmy/917-ci-regression-offline-artifact-browser-journey-d
All checks were successful
CI / lint (push) Successful in 1m58s
CI / build-release (push) Successful in 6s
CI / browser-journey (push) Successful in 56s
CI / release-candidate (push) Successful in 7s

Fix queued issue delivery after offline reload and reconnect.
This commit is contained in:
rockachopa 2026-08-15 21:41:45 +00:00
commit 6b924a4757
2 changed files with 30 additions and 0 deletions

View File

@ -36,6 +36,7 @@
root.fetch = boundary.fetch;
const attach = () => {
boundary.startActivityHeartbeat();
boundary.startReconnectResume();
const button = root.document.getElementById('sign-out');
if (button) button.addEventListener('click', () => boundary.signOut());
const allDevicesButton = root.document.getElementById('sign-out-all');
@ -387,6 +388,12 @@
});
}
function startReconnectResume() {
addActivityListener?.('online', async () => {
if (await refreshOfflineLease()) await resumeQueuedWork();
});
}
async function refreshOfflineLease() {
try {
const response = await sessionFetch(base + 'api/v1/session');
@ -617,6 +624,7 @@
handleServiceWorkerMessage,
refreshOfflineLease,
resumeQueuedWork,
startReconnectResume,
recordActivity,
startActivityHeartbeat,
};

View File

@ -809,6 +809,28 @@ process.stdout.write(JSON.stringify(state));
assert result["workerMessages"] == [{"type": "stackchain-resume-outbox"}]
def test_reconnect_requests_queued_delivery_resume_after_offline_reload():
result = run_session_scenario(
"""
boundary.startReconnectResume();
state.responsePayload = {authenticated:true, expires_at:200000, idle_expires_at:150000};
await state.activityListeners.online();
await new Promise(resolve => setTimeout(resolve, 0));
process.stdout.write(JSON.stringify(state));
"""
)
assert result["requests"][0]["url"] == "/dashboard/api/v1/session"
assert result["workerMessages"] == [
{
"type": "stackchain-session-lease",
"expiresAt": 200000,
"idleExpiresAt": 150000,
},
{"type": "stackchain-resume-outbox"},
]
@pytest.mark.anyio
async def test_dashboard_loads_session_boundary_first_and_offers_sign_out():
html = await dashboard()