Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

kasia-plugin-wp-api-response-modify not published to npm #56

Open
nickpalmer opened this issue Aug 16, 2017 · 7 comments
Open

kasia-plugin-wp-api-response-modify not published to npm #56

nickpalmer opened this issue Aug 16, 2017 · 7 comments

Comments

@nickpalmer
Copy link
Contributor

$ 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?

@sdgluck
Copy link
Contributor

sdgluck commented Aug 17, 2017

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.

@nickpalmer
Copy link
Contributor Author

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.

@sdgluck
Copy link
Contributor

sdgluck commented Aug 18, 2017

Thanks- I hope you find it useful!

@joshlevinson
Copy link

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.

@joshlevinson
Copy link

joshlevinson commented Sep 12, 2017

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.

@MickeyKay
Copy link

MickeyKay commented Jan 10, 2018

@sdgluck Any update here? Still seems to be failing.

@sdgluck
Copy link
Contributor

sdgluck commented Jan 24, 2018

@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!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants