Skip to content

feat: add fetchAbortProbe reusable - #22

Open
Guria wants to merge 1 commit into
mainfrom
feat/fetch-abort-probe
Open

feat: add fetchAbortProbe reusable#22
Guria wants to merge 1 commit into
mainfrom
feat/fetch-abort-probe

Conversation

@Guria

@Guria Guria commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Adds fetchAbortProbe — a browser-test probe that asserts in-flight fetches are aborted (e.g. when navigating away from a Reatom route).

  • createFetchAbortProbe(match, label?) where match is a URL substring or a predicate → { install, restore, waitForStart, waitForAbort, label }. install() is re-entrant; restore() is idempotent.
  • fetchAbortLifecycle(probe) for setup/cleanup hooks and expectFetchAbortOnNavigation(probe, navigateAway, options?) for the full assertion, with assertLoading / timeoutMs.
  • De-coupled from the source app's composeApiUrl (replaced with the string/predicate matcher); also handles a Request-object's own signal.
  • Extracted from a production app (guria/modern-stack src/shared/test/routeFetchAbortProbe.ts).

Patches window.fetch (must be restored). Browser tests cover start/abort resolution, non-matching URLs, predicate form, restore() identity, and pre-aborted signals.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings July 13, 2026 23:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Add a browser fetch probe for asserting route-loader aborts on navigation.
@Guria
Guria force-pushed the feat/fetch-abort-probe branch from a9d0456 to 5b21124 Compare July 13, 2026 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants