kasia
kasia copied to clipboard
kasia-plugin-wp-api-response-modify not published to npm
$ npm install --save kasia-plugin-wp-api-response-modify
npm ERR! code E404
npm ERR! 404 Not Found: kasia-plugin-wp-api-response-modify@latest
Is there a reason this plugin hasn't been pushed to npm?
Ah, good spot. 👍 It hasn't been tested and to be honest I forgot about it after splitting it out into a separate module, probably because we haven't needed it since. I will try and get it tested and published asap.
Not super urgent, I am just evaluating Kasia and wanted to see what that plugin does. Thanks for the work on this project. Looking good so far. Is very aligned with what I was thinking to build already.
Thanks- I hope you find it useful!
Tagging along with this issue–I don't believe the plugin works.
I emulated it with a custom plugin with the same signature as the kasia-wp-modify one and quickly realized that the return value must have a sagas
property, which the plugin does not.
Another oddity: The api-modify effect clobbers the entire state and just returns action.data
post-effects. Upstream code expects the state to be returned in the shape of completeReducer
.
For lack of a better immediate solution, my effect looks like this:
// imports for ActionTypes, modify, completeReducer, and normalise
const sanifyWPKasia = (_, effects) => ({
reducers: {
[ActionTypes.RequestComplete]: (state, action) => {
const data = modify(action.data, effects);
return completeReducer(normalise)(state, merge({}, action, { data }));
},
},
sagas: [],
});
Once the modify effects transform the action data, upstream expects to find the data in state.entities
, so I passed it back through completeReducer
.
@sdgluck Any update here? Still seems to be failing.
@MickeyKay Apologies, I've not found the time to fix this yet. Am working on the next version of Kasia atm (including your req/res
feature request 😃). This is next on the list!