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

Use node-wpapi autodiscovery for custom content types #18

Open
sdgluck opened this issue Aug 10, 2016 · 2 comments
Open

Use node-wpapi autodiscovery for custom content types #18

sdgluck opened this issue Aug 10, 2016 · 2 comments

Comments

@sdgluck
Copy link
Contributor

sdgluck commented Aug 10, 2016

At the moment the user is required to define explicitly the custom content types that are defined within the WP instance they are connecting to. It would be great if they could be "auto-discovered" a la node-wpapi, probably through an option.

Implementing this would require deferring calls to the WP API until the autodiscovery completed, so keeping a record internally somewhere of its completion.

@sdgluck sdgluck modified the milestones: 2.5.0, 2.6.0 Aug 24, 2016
@sdgluck sdgluck modified the milestones: 4.0.0, 3.3.0 Oct 3, 2016
@sdgluck sdgluck removed this from the 4.0.0 milestone Nov 22, 2016
@sdgluck sdgluck added this to the v4.1 milestone Jan 31, 2017
@sdgluck
Copy link
Contributor Author

sdgluck commented Feb 1, 2017

Thoughts for the implementer...

Changes to API:

  • configuration wpapi option should accept a Promise which should resolve with instance of node-wpapi (a la WPAPI.discover).
  • need to derive custom content types from the node-wpapi instance and register them internally so the decorators recognise them as legitimate.
  • [discussion] should contentTypes be ignored if wpapi config option receives a Promise?

Changes to internals:

  • wpapi.js: should store node-wpapi instance as a Promise regardless of whether wpapi config option is a Promise. i.e. the config option value should be passed through Promise.resolve().
  • redux/sagas.js: fetch saga should wait on resolution of the wpapi Promise. e.g. const wpapi = yield getWP() before performing the query.

@sdgluck sdgluck added the small label Feb 1, 2017
@sdgluck sdgluck added medium and removed small labels Feb 23, 2017
@sdgluck sdgluck self-assigned this Feb 23, 2017
@sdgluck
Copy link
Contributor Author

sdgluck commented Feb 23, 2017

In progress on branch autodiscovery-support.

@sdgluck sdgluck removed this from the v4.1 milestone Aug 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant