You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Overview
The existing ergonomics of createServerFn do not allow for abstractions to be written and still retain the ability to mutate the object downstream. The alternative (global middleware) can be too heavy handed. This request is a proposal to allow the middleware() function to be called as many times as needed and to continuously append to the middleware array.
Example
It's not hard to imagine a scenario where a dev wants to create some light abstraction over the createServerFn function specific to their application:
Today you cannot call middleware() for a second time in the AdminstratorService file which limits your ability to create abstractions like this. The existing builder-like pattern of createServerFn seems like it would naturally allow for this.
Happy to contribute a PR if this seems like a good direction.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Overview
The existing ergonomics of
createServerFn
do not allow for abstractions to be written and still retain the ability to mutate the object downstream. The alternative (global middleware) can be too heavy handed. This request is a proposal to allow themiddleware()
function to be called as many times as needed and to continuously append to the middleware array.Example
It's not hard to imagine a scenario where a dev wants to create some light abstraction over the
createServerFn
function specific to their application:Today you cannot call
middleware()
for a second time in the AdminstratorService file which limits your ability to create abstractions like this. The existing builder-like pattern of createServerFn seems like it would naturally allow for this.Happy to contribute a PR if this seems like a good direction.
Beta Was this translation helpful? Give feedback.
All reactions