-
Notifications
You must be signed in to change notification settings - Fork 50k
Open
Labels
Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug
Description
Note: SORRY IF I CREATED USING BUG REPORT TEMPLATE, PLEASE CORRECT ME THE TEMPLATE I SHOULD USE IF I AM WRONG, because I can't find a template named "Feature Request" :(((
Issue Type: Enhancement / Feature Request
Currently, when using use() in React server components, if a server-side action fails or is unavailable, it may fall back to executing on the client side. I propose adding a parameter or option that allows developers to disallow this fallback, ensuring that certain actions always remain server-only.
This would be useful in scenarios where:
- Sensitive operations must never execute on the client.
- Server-specific resources or data are required.
- Consistency and security need to be enforced.
Proposed Behavior:
- Add a boolean parameter (e.g.,
allowClientFallback = true) touse(). - When set to
false,use()should throw an error if the server action is unavailable, instead of falling back to client-side execution.
Example:
const data = use(fetchServerData, { allowClientFallback: false });Benefits:
- Prevent accidental execution of server-only logic on the client.
- Improve security and predictability of server components.
- Give developers explicit control over fallback behavior.
asiftonim
Metadata
Metadata
Assignees
Labels
Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug