Skip to content

Commit c740c5e

Browse files
feat(plugin-blocker): add blockerPlugin and useBlocker hook (#682)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent a43dbe4 commit c740c5e

85 files changed

Lines changed: 4595 additions & 39 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/add-plugin-blocker.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
"@stackflow/plugin-blocker": minor
3+
---
4+
5+
Add blockerPlugin and useBlocker hook for navigation blocking
6+
7+
- `useBlocker({ shouldBlock, onBlocked })` hook to declare blocking policies per activity
8+
- Blocking set model: multiple blockers can block a navigation, all must `proceed()` for it to execute
9+
- Only blockers from active (`isActive: true`) activities are evaluated
10+
- `onBlocked` notifications are serialized in navigation occurrence order (no re-entrancy)
11+
- Error isolation: one blocker's `onBlocked` throwing does not prevent other blockers from being notified
12+
- Plugin-level `onError` option for custom error handling (defaults to `console.error`)
13+
- Blocker cleanup on component unmount; previously captured `proceed` remains callable

0 commit comments

Comments
 (0)