diff --git a/webapp/app/templates/partials/section_card.html b/webapp/app/templates/partials/section_card.html index 19cf5cc..d070622 100644 --- a/webapp/app/templates/partials/section_card.html +++ b/webapp/app/templates/partials/section_card.html @@ -1,7 +1,9 @@ {% if oob and not (s.sections | selectattr("status", "in", ["pending", "generating"]) | list) %}
+ {% with status_oob=false %} {% include "partials/step3_actions.html" %} + {% endwith %}
{% endif %} {% if sec.status in ('pending', 'generating') %} diff --git a/webapp/app/templates/partials/step3_actions.html b/webapp/app/templates/partials/step3_actions.html index 0338cbf..61c6811 100644 --- a/webapp/app/templates/partials/step3_actions.html +++ b/webapp/app/templates/partials/step3_actions.html @@ -1,4 +1,8 @@ {% set drafting = s.sections | rejectattr('status', 'equalto', 'done') | list %} +{% set status_oob = status_oob|default(true) %} +{% if not drafting and status_oob %} +
+{% endif %}
← Back diff --git a/webapp/tests/test_routes.py b/webapp/tests/test_routes.py index ad84725..29c6a93 100644 --- a/webapp/tests/test_routes.py +++ b/webapp/tests/test_routes.py @@ -74,6 +74,21 @@ def test_last_section_poll_clears_stale_status_bar(): body = resp.body.decode() assert 'id="status-bar" hx-swap-oob="innerHTML"' in body + assert body.count('id="status-bar"') == 1 assert 'id="step3-actions" hx-swap-oob="innerHTML"' in body assert "Party review" in body assert "Finish" in body + + +def test_step3_actions_clears_status_when_buttons_appear(): + """The job_done-triggered button refresh should clear the first-paint + model-loading fallback even if no section-card poll runs afterward.""" + s = state.create() + s.sections = [Section(id="overview", title="Overview", instruction="", content="Done", status="done")] + + resp = asyncio.run(main.step3_actions(_FakeRequest(), s.id)) + body = resp.body.decode() + + assert 'id="status-bar" hx-swap-oob="innerHTML"' in body + assert "Party review" in body + assert "Finish" in body