-
Notifications
You must be signed in to change notification settings - Fork 145
Conversation
cb8f4b7
to
d6aefc5
Compare
Maybe as part of this, maybe separate - it would be nice to have an example where we use fresh data to detect that a new instance of a resource is available (e.g. a new order) and fetch it (e.g. to auto update a table bound to orders.)
Or maybe this already works without user intervention? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take another crack at running this today, but in the meantime I wanted to get these pending comments posted.
hey @coderkevin, on a fresh clone of
are some modules missing from |
This PR adds fresh-data with a WooCommerce API spec to fulfill order information. It then replaces the existing selectors for the orders table with the new selectors as a proof-of-concept.
d6aefc5
to
0b63da3
Compare
This adds temporary code for a `withSelect` function outside of `@wordpress/data` until the context PR is merged: WordPress/gutenberg#11460
This PR uses the updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is building and testing well for me. I added a new order in another tab and it showed up pretty quickly. Nice work 👍
Super happy to see this land @coderkevin - way to push it through! |
Thanks! Now the rest of the work can begin. 😄 |
This adds a wc-api module as a
@wordpress/data
generic store, which is based on Fresh DataNote: This PR contains a workaround that will no longer be necessary after the following Gutenberg PR is merged: WordPress/gutenberg#11460
This leverages the general purpose fresh-data framework to create a woocommerce-specific api implementation. The first use of this is in the orders fetching for the orders table in the analytics report. The goal was to have minimal changes to the application code but still gain the advantages of sharing data across components and automatic re-fetching of data.
Detailed test instructions:
npm install
npm start
http://localhost/wp-admin/admin.php?page=wc-admin#/analytics/orders
and ensure that the orders table populates properly at the bottom.For additional debugging information, type
localStorage.setItem( 'debug', 'fresh-data:*' );
to see the updating and scheduling of data fetches.