Skip to content

fix: skip loader work for prevented actions (FEP-2635)#738

Merged
ENvironmentSet merged 9 commits into
mainfrom
plugin-loader-preventdefault-support
Jul 26, 2026
Merged

fix: skip loader work for prevented actions (FEP-2635)#738
ENvironmentSet merged 9 commits into
mainfrom
plugin-loader-preventdefault-support

Conversation

@ENvironmentSet

Copy link
Copy Markdown
Collaborator

Summary

  • expose live, action-local actions.isPrevented() state to every Core pre-effect hook without short-circuiting the remaining hooks
  • make the built-in React loader skip loader, lazy preload, pause/resume, and loader-data injection for prevented push and replace actions
  • document the prevented-action contract and add a Core minor / React patch changeset

Verification

  • /tmp/FEP-2635/runtime-harness.cjs
  • yarn workspace @stackflow/core test
  • yarn workspace @stackflow/core typecheck
  • yarn workspace @stackflow/core build
  • yarn workspace @stackflow/react typecheck
  • yarn workspace @stackflow/react build
  • yarn workspace @stackflow/plugin-blocker test
  • yarn lint
  • yarn changeset status
  • git diff --check

FEP-2635: https://linear.app/daangn/issue/FEP-2635

@changeset-bot

changeset-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d114355

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@stackflow/core Minor
@stackflow/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: aa009f57-0f28-4b22-b00b-f887f42c38ec

📥 Commits

Reviewing files that changed from the base of the PR and between b44aba9 and 71f227a.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (11)
  • .changeset/fep-2635-observe-prevented-actions.md
  • .changeset/fep-2635-skip-prevented-loader-work.md
  • CONTEXT.md
  • core/src/interfaces/StackflowPluginHook.ts
  • core/src/utils/triggerPreEffectHooks.ts
  • docs/adr/0001-observe-prevented-actions-without-short-circuiting-hooks.md
  • docs/pages/docs/advanced/write-plugin.en.mdx
  • docs/pages/docs/advanced/write-plugin.ko.mdx
  • integrations/react/package.json
  • integrations/react/src/loader/loaderPlugin.tsx
  • plans/fep-2635-plugin-loader-preventdefault-support/plan.md

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Pre-effect hooks can now check whether an action has been prevented using actions.isPrevented().
    • Prevented actions no longer trigger loader execution, preloading, or pause/resume work.
  • Bug Fixes
    • Remaining pre-effect hooks continue running after an action is prevented, preserving plugin processing order.
  • Documentation
    • Updated plugin guidance and navigation documentation to describe prevented-action behavior.

Walkthrough

Core pre-effect hooks now expose live action prevention state without short-circuiting remaining hooks. The React loader exits before loader-related work for prevented push and replace actions, with updated documentation, plans, changesets, and Core peer dependency requirements.

Changes

Prevented action handling

Layer / File(s) Summary
Core prevention state API
core/src/interfaces/StackflowPluginHook.ts, core/src/utils/triggerPreEffectHooks.ts, docs/adr/*, docs/pages/docs/advanced/*
Pre-effect hooks receive actions.isPrevented(), and documentation defines continued hook execution after preventDefault().
React loader prevention guard
integrations/react/src/loader/loaderPlugin.tsx, integrations/react/package.json
The loader skips work for prevented actions, and the Core peer dependency now requires ^3.0.0.
Behavior contract and release documentation
plans/fep-2635-plugin-loader-preventdefault-support/plan.md, CONTEXT.md, .changeset/*
Design and navigation contracts describe the behavior, with Core minor and React patch release metadata.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Navigation
  participant PreEffectHooks
  participant ReactLoader
  participant DomainDispatch
  Navigation->>PreEffectHooks: Run navigation pre-effects
  PreEffectHooks->>ReactLoader: Provide actions.isPrevented()
  ReactLoader->>ReactLoader: Skip loader and pause/resume if prevented
  PreEffectHooks->>DomainDispatch: Cancel default dispatch if prevented
Loading

Possibly related PRs

Suggested reviewers: tonyfromundefined

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change of skipping loader work for prevented actions.
Description check ✅ Passed The description matches the changeset and objective by describing the new prevented-action behavior and related docs and changesets.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch plugin-loader-preventdefault-support

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 24, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
stackflow-docs d114355 Commit Preview URL Jul 26 2026, 04:40 PM

@pkg-pr-new

pkg-pr-new Bot commented Jul 24, 2026

Copy link
Copy Markdown
@stackflow/core

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/core@738.tgz

@stackflow/link

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/link@738.tgz

@stackflow/plugin-activity-guard

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-activity-guard@738.tgz

@stackflow/plugin-basic-ui

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-basic-ui@738.tgz

@stackflow/plugin-blocker

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-blocker@738.tgz

@stackflow/plugin-devtools

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-devtools@738.tgz

@stackflow/plugin-google-analytics-4

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-google-analytics-4@738.tgz

@stackflow/plugin-history-sync

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-history-sync@738.tgz

@stackflow/plugin-lifecycle

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-lifecycle@738.tgz

@stackflow/plugin-renderer-basic

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-renderer-basic@738.tgz

@stackflow/plugin-renderer-web

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-renderer-web@738.tgz

@stackflow/plugin-sentry

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-sentry@738.tgz

@stackflow/plugin-stack-depth-change

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-stack-depth-change@738.tgz

@stackflow/plugin-stack-persistence

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/plugin-stack-persistence@738.tgz

@stackflow/react-ui-core

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/react-ui-core@738.tgz

@stackflow/react

yarn add https://pkg.pr.new/daangn/stackflow/@stackflow/react@738.tgz

commit: b2a1d48

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 24, 2026

Copy link
Copy Markdown

Deploying stackflow-demo with  Cloudflare Pages  Cloudflare Pages

Latest commit: b2a1d48
Status: ✅  Deploy successful!
Preview URL: https://92671822.stackflow-demo.pages.dev
Branch Preview URL: https://plugin-loader-preventdefault.stackflow-demo.pages.dev

View logs

Comment thread integrations/react/src/loader/loaderPlugin.tsx Outdated
Comment thread docs/pages/docs/advanced/write-plugin.ko.mdx Outdated
Comment thread .changeset/fep-2635-prevented-loader.md Outdated
@ENvironmentSet
ENvironmentSet marked this pull request as ready for review July 24, 2026 08:51
@ENvironmentSet
ENvironmentSet enabled auto-merge (squash) July 24, 2026 08:51
@ENvironmentSet
ENvironmentSet disabled auto-merge July 26, 2026 16:37
@ENvironmentSet
ENvironmentSet enabled auto-merge (squash) July 26, 2026 16:38
@ENvironmentSet
ENvironmentSet merged commit 8ce8866 into main Jul 26, 2026
6 of 8 checks passed
@ENvironmentSet
ENvironmentSet deleted the plugin-loader-preventdefault-support branch July 26, 2026 16:38
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.

1 participant