diff --git a/frontend/dashboard.js b/frontend/dashboard.js
index 2d526d7..58f69f5 100644
--- a/frontend/dashboard.js
+++ b/frontend/dashboard.js
@@ -929,6 +929,10 @@
panel: qs('#update-sheet .update-sheet-panel'),
jump: qs('#jump-update-new-activity'),
});
+ const issueDetailPosition = createWorkDetailPosition({ panel: qs('#issue-sheet .issue-sheet-panel') });
+ const pullDetailPosition = createWorkDetailPosition({ panel: qs('#pull-sheet .pull-sheet-panel') });
+ const reviewDetailPosition = createWorkDetailPosition({ panel: qs('#review-sheet .review-sheet-panel') });
+ const workDetailIdentity = (kind, item) => kind + ':' + item.key;
qs('#jump-update-new-activity').addEventListener('click', () => updateReadPosition.jump());
qs('#focus-update-reply').addEventListener('click', () => {
const composer = qs('#update-reply');
@@ -3166,6 +3170,7 @@
async function openIssueSheet(item, trigger, offlineDetail = null) {
if (!item) return;
+ issueDetailPosition.open(workDetailIdentity('issue', item));
qs('#issue-planning').inert = false;
qs('#issue-handoff').inert = false;
selectedIssue = item;
@@ -3358,6 +3363,7 @@
async function openPullSheet(item, trigger, offlineDetail = null) {
if (!item) return;
if (!await ensurePullWorkflow(trigger)) return;
+ pullDetailPosition.open(workDetailIdentity('pull', item));
if (!createPullSheet.sameTarget(selectedPull, item)) pullAttachmentController.clear();
qs('#pull-review').inert = false;
qs('#pull-ownership').inert = false;
@@ -3958,6 +3964,7 @@
async function openReviewSheet(item, trigger, cachedDetail = null) {
if (!item || !await ensurePullWorkflow(trigger)) return;
+ reviewDetailPosition.open(workDetailIdentity('review', item));
selectedReview = item;
reviewTrigger = trigger;
offlineReview = Boolean(cachedDetail);
diff --git a/frontend/index.html b/frontend/index.html
index 47f8a1b..ac53543 100644
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -1091,6 +1091,7 @@
+
diff --git a/frontend/service-worker.js b/frontend/service-worker.js
index a0aedfb..99378d4 100644
--- a/frontend/service-worker.js
+++ b/frontend/service-worker.js
@@ -1,6 +1,6 @@
const BASE = new URL('./', self.location.href).pathname;
importScripts(BASE + 'static/background-issue-sync.js');
-const CACHE = 'stackchain-dashboard-shell-v100';
+const CACHE = 'stackchain-dashboard-shell-v101';
const OFFLINE_LEASE_URL = new URL(BASE + '__offline-session-lease', self.location.origin).href;
const OUTAGE_STATUSES = new Set([500, 502, 503, 504]);
const NAVIGATION_TIMEOUT_MS = self.__STACKCHAIN_NAVIGATION_TIMEOUT_MS || 4000;
@@ -79,6 +79,7 @@ const SHELL = [
BASE + 'static/update-triage-session.js',
BASE + 'static/update-review-handoff.js',
BASE + 'static/update-read-position.js',
+ BASE + 'static/work-detail-position.js',
BASE + 'static/update-triage-launcher.js',
BASE + 'static/update-triage-gesture.js',
BASE + 'static/update-decision-transaction.js',
diff --git a/frontend/work-detail-position.js b/frontend/work-detail-position.js
new file mode 100644
index 0000000..355ba8f
--- /dev/null
+++ b/frontend/work-detail-position.js
@@ -0,0 +1 @@
+(function(r,f){if(typeof module==='object'&&module.exports)module.exports=f;else r.createWorkDetailPosition=f})(typeof self!=='undefined'?self:this,function(o){let i='';return{open(n){n=String(n||'');if(n&&n===i)return false;i=n;o.panel.scrollTop=0;return true}}});
diff --git a/tests/test_comment_next.py b/tests/test_comment_next.py
index 924611b..8038809 100644
--- a/tests/test_comment_next.py
+++ b/tests/test_comment_next.py
@@ -303,4 +303,4 @@ async def test_unread_update_offers_reply_mark_read_and_next_independent_of_toda
assert '.update-reply-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr));' in html
assert '.update-reply-actions button { min-height:44px;' in html
worker = (Path(__file__).parents[1] / "frontend" / "service-worker.js").read_text()
- assert "stackchain-dashboard-shell-v100" in worker
+ assert "stackchain-dashboard-shell-v101" in worker
diff --git a/tests/test_later_sync.py b/tests/test_later_sync.py
index 1b7909d..77a05a3 100644
--- a/tests/test_later_sync.py
+++ b/tests/test_later_sync.py
@@ -347,5 +347,5 @@ async def test_dashboard_syncs_every_later_change_and_exposes_account_status():
def test_later_sync_ships_atomically_in_the_offline_shell():
source = (Path(__file__).parents[1] / "frontend" / "service-worker.js").read_text()
- assert "stackchain-dashboard-shell-v100" in source
+ assert "stackchain-dashboard-shell-v101" in source
assert "BASE + 'static/later-sync.js'" in source
diff --git a/tests/test_markdown_renderer.py b/tests/test_markdown_renderer.py
index 8626e3b..36c9f14 100644
--- a/tests/test_markdown_renderer.py
+++ b/tests/test_markdown_renderer.py
@@ -137,4 +137,4 @@ def test_markdown_work_bodies_are_mobile_safe_block_containers():
assert ".markdown-content { min-width:0; max-width:100%; overflow-wrap:anywhere;" in css
assert ".markdown-content pre { max-width:100%; overflow-x:auto;" in css
assert ".markdown-content a { min-height:44px;" in css
- assert "stackchain-dashboard-shell-v100" in worker
+ assert "stackchain-dashboard-shell-v101" in worker
diff --git a/tests/test_mobile_composer_integration.py b/tests/test_mobile_composer_integration.py
index 641f80a..b814de5 100644
--- a/tests/test_mobile_composer_integration.py
+++ b/tests/test_mobile_composer_integration.py
@@ -45,7 +45,7 @@ def test_offline_shell_contains_every_local_dashboard_runtime_asset():
shell_assets = set(re.findall(r"BASE \+ '([^']+)'", worker.split("async function sessionCsrf", 1)[0]))
assert local_assets <= shell_assets, f"Offline shell is missing: {sorted(local_assets - shell_assets)}"
- assert "stackchain-dashboard-shell-v100" in worker
+ assert "stackchain-dashboard-shell-v101" in worker
def test_all_conversation_composers_offer_accessible_mobile_mentions():
diff --git a/tests/test_mobile_device_setup.py b/tests/test_mobile_device_setup.py
index b88c3a2..5f94ada 100644
--- a/tests/test_mobile_device_setup.py
+++ b/tests/test_mobile_device_setup.py
@@ -214,7 +214,7 @@ def test_mobile_dashboard_mounts_phone_safe_device_setup_flow():
assert "promptStorage:localStorage" in dashboard
assert "pushControllerReady.then(ensureDeviceSetup)" in dashboard
assert "BASE + 'static/mobile-device-setup.js'" in worker
- assert "stackchain-dashboard-shell-v100" in worker
+ assert "stackchain-dashboard-shell-v101" in worker
assert ".device-setup-panel" in css
assert ".device-readiness-card" in css
assert "overflow-x:hidden" in css
diff --git a/tests/test_plan_today.py b/tests/test_plan_today.py
index c2d3ff6..5e34834 100644
--- a/tests/test_plan_today.py
+++ b/tests/test_plan_today.py
@@ -410,7 +410,7 @@ async def test_plan_today_wires_cancel_back_and_success_through_overlay_history(
def test_plan_today_controller_is_available_in_the_offline_shell():
source = SERVICE_WORKER.read_text()
- assert "stackchain-dashboard-shell-v100" in source
+ assert "stackchain-dashboard-shell-v101" in source
assert "BASE + 'static/plan-today.js'" in source
assert "BASE + 'static/plan-today-readiness.js'" in source
assert "BASE + 'static/plan-today-preview.js'" in source
diff --git a/tests/test_service_worker.py b/tests/test_service_worker.py
index 19871c7..446fcca 100644
--- a/tests/test_service_worker.py
+++ b/tests/test_service_worker.py
@@ -150,7 +150,7 @@ async function dispatchPush(payload) {{
def test_resumable_today_session_ships_in_a_new_offline_shell():
source = WORKER.read_text()
- assert "stackchain-dashboard-shell-v100" in source
+ assert "stackchain-dashboard-shell-v101" in source
assert "BASE + 'static/my-work.js'" in source
assert "BASE + 'static/dashboard.js'" in source
assert "BASE + 'static/dashboard.css'" in source
@@ -159,14 +159,14 @@ def test_resumable_today_session_ships_in_a_new_offline_shell():
def test_ownership_exit_runtime_rolls_the_offline_shell_cache():
source = WORKER.read_text()
- assert "stackchain-dashboard-shell-v100" in source
+ assert "stackchain-dashboard-shell-v101" in source
assert "BASE + 'static/dashboard.js'" in source
def test_offline_review_next_ships_today_completion_atomically():
source = WORKER.read_text()
- assert "stackchain-dashboard-shell-v100" in source
+ assert "stackchain-dashboard-shell-v101" in source
assert "BASE + 'static/today-completion.js'" in source
assert "BASE + 'static/dashboard.js'" in source
@@ -174,7 +174,7 @@ def test_offline_review_next_ships_today_completion_atomically():
def test_duplicate_aware_capture_ships_in_a_new_offline_shell():
source = WORKER.read_text()
- assert "stackchain-dashboard-shell-v100" in source
+ assert "stackchain-dashboard-shell-v101" in source
assert "BASE + 'static/create-issue-sheet.js'" in source
assert "BASE + 'static/dashboard.js'" in source
@@ -182,14 +182,14 @@ def test_duplicate_aware_capture_ships_in_a_new_offline_shell():
def test_exact_later_picker_ships_atomically_in_a_new_offline_shell():
source = WORKER.read_text()
- assert "stackchain-dashboard-shell-v100" in source
+ assert "stackchain-dashboard-shell-v101" in source
assert "BASE + 'static/later-picker.js'" in source
def test_navigation_deadline_ships_in_a_new_shell_cache():
source = WORKER.read_text()
- assert "stackchain-dashboard-shell-v100" in source
+ assert "stackchain-dashboard-shell-v101" in source
assert "BASE + 'static/dashboard.css'" in source
assert "BASE + 'static/dashboard.js'" in source
assert "BASE + 'static/install-app.js'" in source
@@ -198,21 +198,21 @@ def test_navigation_deadline_ships_in_a_new_shell_cache():
def test_today_convergence_ships_in_a_new_shell_cache():
source = WORKER.read_text()
- assert "stackchain-dashboard-shell-v100" in source
+ assert "stackchain-dashboard-shell-v101" in source
assert "BASE + 'static/today-sync.js'" in source
def test_mobile_search_viewport_ships_in_a_new_offline_shell():
source = WORKER.read_text()
- assert "stackchain-dashboard-shell-v100" in source
+ assert "stackchain-dashboard-shell-v101" in source
assert "BASE + 'static/mobile-search-viewport.js'" in source
def test_update_ownership_flow_ships_atomically_in_a_new_offline_shell():
source = WORKER.read_text()
- assert "stackchain-dashboard-shell-v100" in source
+ assert "stackchain-dashboard-shell-v101" in source
assert "BASE + 'static/update-ownership.js'" in source
@@ -761,7 +761,7 @@ def test_one_session_bound_csrf_proof_is_reused_for_a_background_drain():
def test_queue_today_ships_atomically_in_a_new_offline_shell():
source = WORKER.read_text()
- assert "stackchain-dashboard-shell-v100" in source
+ assert "stackchain-dashboard-shell-v101" in source
assert "BASE + 'static/queue-today.js'" in source
@@ -849,6 +849,7 @@ def test_install_precaches_complete_subpath_scoped_app_shell():
"/dashboard/static/update-triage-session.js",
"/dashboard/static/update-review-handoff.js",
"/dashboard/static/update-read-position.js",
+ "/dashboard/static/work-detail-position.js",
"/dashboard/static/update-triage-launcher.js",
"/dashboard/static/update-triage-gesture.js",
"/dashboard/static/update-decision-transaction.js",
diff --git a/tests/test_today_readiness.py b/tests/test_today_readiness.py
index 9ff852c..986ca8b 100644
--- a/tests/test_today_readiness.py
+++ b/tests/test_today_readiness.py
@@ -221,7 +221,7 @@ async def test_today_blocker_opens_existing_preview_and_preserves_readiness_gate
def test_readiness_runtime_is_available_in_offline_shell():
service_worker = SERVICE_WORKER.read_text()
- assert "const CACHE = 'stackchain-dashboard-shell-v100';" in service_worker
+ assert "const CACHE = 'stackchain-dashboard-shell-v101';" in service_worker
assert "BASE + 'static/today-readiness.js'" in service_worker
diff --git a/tests/test_today_sync.py b/tests/test_today_sync.py
index f658699..b9c3cd1 100644
--- a/tests/test_today_sync.py
+++ b/tests/test_today_sync.py
@@ -127,7 +127,7 @@ sync.enqueueConfiguration(120, {{'issue:r:1:':60}});
def test_inflight_today_drain_ships_in_a_new_offline_shell():
source = (Path(__file__).parents[1] / "frontend" / "service-worker.js").read_text()
- assert "stackchain-dashboard-shell-v100" in source
+ assert "stackchain-dashboard-shell-v101" in source
assert "BASE + 'static/today-sync.js'" in source
diff --git a/tests/test_work_detail_position.py b/tests/test_work_detail_position.py
new file mode 100644
index 0000000..0679661
--- /dev/null
+++ b/tests/test_work_detail_position.py
@@ -0,0 +1,60 @@
+import json
+import subprocess
+from pathlib import Path
+
+import pytest
+
+from tests.dashboard_bundle import dashboard
+
+
+POSITIONER = Path(__file__).resolve().parents[1] / "frontend" / "work-detail-position.js"
+
+
+def run_positioner(script: str) -> dict:
+ source = f"const createPositioner = require({json.dumps(str(POSITIONER))});\n" + script
+ result = subprocess.run(["node", "-e", source], capture_output=True, text=True)
+ assert result.returncode == 0, result.stderr
+ return json.loads(result.stdout)
+
+
+def test_different_work_item_resets_to_top_while_same_item_keeps_position():
+ result = run_positioner("""
+const panel = {scrollTop:640};
+const positioner = createPositioner({panel});
+const first = positioner.open('issue:stackchain/dashboard#41');
+panel.scrollTop = 380;
+const same = positioner.open('issue:stackchain/dashboard#41');
+const changed = positioner.open('pull:stackchain/dashboard#42');
+process.stdout.write(JSON.stringify({first, same, changed, top:panel.scrollTop}));
+""")
+
+ assert result == {"first": True, "same": False, "changed": True, "top": 0}
+
+
+def test_each_panel_tracks_its_own_visible_identity():
+ result = run_positioner("""
+const issuePanel = {scrollTop:500};
+const pullPanel = {scrollTop:700};
+const issue = createPositioner({panel:issuePanel});
+const pull = createPositioner({panel:pullPanel});
+issue.open('issue:stackchain/dashboard#8');
+pull.open('pull:stackchain/dashboard#9');
+issuePanel.scrollTop = 220;
+pullPanel.scrollTop = 330;
+issue.open('issue:stackchain/dashboard#8');
+pull.open('review:stackchain/dashboard#9');
+process.stdout.write(JSON.stringify({issueTop:issuePanel.scrollTop, pullTop:pullPanel.scrollTop}));
+""")
+
+ assert result == {"issueTop": 220, "pullTop": 0}
+
+
+@pytest.mark.anyio
+async def test_dashboard_positions_issue_pull_and_review_openers():
+ html = await dashboard()
+
+ assert '' in html
+ assert "issueDetailPosition.open(workDetailIdentity('issue', item))" in html
+ assert "pullDetailPosition.open(workDetailIdentity('pull', item))" in html
+ assert "reviewDetailPosition.open(workDetailIdentity('review', item))" in html
+ assert "BASE + 'static/work-detail-position.js'" in (POSITIONER.parent / "service-worker.js").read_text()