Skip to content

Make region editor startup lighter and stable #83

Description

@n30nex

Summary

The region boundary editor performs a large data download and starts Cloudflare Turnstile immediately on page load, before a visitor has selected a proposal type or attempted to submit. The live page is usable on a fast connection, but startup is unnecessarily heavy and Chromium never reaches a stable network-idle state.

Audit target: production revision 578e7d1cdcbeeb03a9946b39e7fdfc2f932dae33 on 2026-08-29.

Reproduction and evidence

  1. Open the English editor or the French editor in a fresh browser context.
  2. Observe network activity before choosing a proposal type or pressing Submit for review.

A fresh Chromium trace for the English route recorded 69 requests and about 6.19 MB transferred. The largest initial responses were:

  • canada-region-partition.geojson: 3,101,248 bytes transferred
  • cells-35.topo.json: 1,357,836 bytes transferred
  • canada-region-membership.csv: 470,031 bytes transferred
  • Cloudflare Turnstile document/script/challenge traffic: several additional requests, including responses of 383,934 and 104,253 bytes

The submission widget is started unconditionally by initialiseSubmission() at application startup. It fetches submission configuration, loads Turnstile, and renders the challenge even when the visitor is only inspecting the map.

The production browser matrix otherwise passed 387 checks, but four editor accessibility navigations timed out waiting for networkidle. An isolated rerun reproduced the timeout in all 6 Chromium combinations tested (English/French across desktop, dark, and mobile). The traces show continuing Cloudflare challenge activity rather than an accessibility violation.

Expected result

  • Make the editor's first useful screen available without loading submission-only infrastructure.
  • Load Turnstile only when the visitor reaches or invokes the submission step, while preserving the current fail-closed submission behavior.
  • Reduce the initial region payload where practical (for example, load the selected province/editor detail only when required rather than downloading all national editing data up front).
  • Expose a deterministic app-ready state that browser tests can wait for instead of depending on third-party network idleness.

Acceptance checks

  • Opening either editor route without starting a proposal does not contact challenges.cloudflare.com.
  • A fresh mobile load transfers materially less than the current ~6.19 MB before the editor is usable.
  • English and French submission paths still require a valid Turnstile token and pass their end-to-end tests.
  • The live Chromium accessibility check completes without a navigation timeout.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions