mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #835] [MERGED] fix: return error for client hook used without directive #884
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#884
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/835
Author: @james-elicx
Created: 4/13/2026
Status: ✅ Merged
Merged: 4/13/2026
Merged by: @james-elicx
Base:
main← Head:james/error-use-client📝 Commits (2)
bb12f88fix: display error for client hook without directive0961b4ffix📊 Changes
6 files changed (+173 additions, -6 deletions)
View changed files
📝
packages/vinext/src/index.ts(+50 -2)➕
packages/vinext/src/shims/client-hook-error.ts(+15 -0)➕
packages/vinext/src/shims/navigation.react-server.ts(+72 -0)📝
packages/vinext/src/shims/navigation.ts(+0 -4)📝
tests/app-router.test.ts(+15 -0)➕
tests/fixtures/app-basic/app/missing-use-client-test/page.tsx(+21 -0)📄 Description
fixes #834
Summary
Approach
A new navigation.react-server.ts shim re-exports server-safe APIs (redirect, notFound, setNavigationContext, etc.) from the canonical navigation.ts and adds error-throwing stubs for client-only hooks. The resolveId hook routes next/navigation to this variant in the RSC environment and to the full shim elsewhere.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.