🚨 Breaking Changes 🚨
-
The procedure caller no longer accepts
FormDatadirectly. Please use the newcreateFormActionfor handlingFormData. -
hooksoption forhandleFetchRequestnow rename toexecute
🚀 New Features 🚀
Introducing @orpc/next, a dedicated package for Next.js! This package brings powerful new tools to enhance your development experience:
createFormAction: Easily create procedure callers that acceptFormData.createSafeAction: Build actions with enhanced error-handling capabilities for the client.useSafeAction: A React hook designed for actions created withcreateSafeAction, providing more detailed error information.useAction: A React hook for executing anyorpcprocedure or action, offering less detailed error information, ideal for simpler use cases.
🌟 Improvement 🌟
Any funtions like handleFetchRequest createProcedureCaller, createRouterCaller, createSafeAction, createFormAction, ... now accepts hooks to help me intercept the process
const caller = createProcedureCaller({
procedure: getting,
execute: async (input, context, meta) => {
// do something
return await meta.next()
}
// onStart(state, context, meta)
// onSuccess(state, context, meta)
// onError(state, context, meta)
// onFinish(state, context, meta)
})