I spend a lot of my days in words. Code reviews. Slack threads. 1:1s. Docs. Blog posts like this one. Words are the medium of my work, my relationships, my thoughts. They’re also how I make sense of my own inner world as a husband, a dad, my beliefs, a leader at a company that… Read more →
I’m sitting here writing this post, with a few days left in my 3 month Sabbatical. One of the great perks of working for Automattic is that every 5 years I have the opportunity to take a 2-3 month fully paid time away from my regular work with no expectations beyond disconnecting from work. It… Read more →
One of the things I wanted to do during my sabbatical (more on that later this week) was to create (from scratch) a new block theme for my site. I haven’t done this in a long time and thought it’d be a good way to get familiar with the state of block themes as a… Read more →
A colleague recently gave me a nice compliment. He said, “I recognize you as one of the most productive and impactful people in Automattic.” He followed up with a question, “What is your secret? What advice or tips can you share with someone like me?” The compliment was encouraging – there are some days I… Read more →
Roughly three years ago I started writing a series of posts on the wp.data API. Little did I know how valuable this post would be to so many people within the WordPress community (and at my current employer Automattic)! Of course, as it is with all APIs, changes happen and while the content of the… Read more →
On the evening of April 5th, 2022, my sister made her journey from this life to the next. My heart is heavy and full of grief. Still. Writing this has been cathartic. I’ve started and stopped many times over the past few months. Often weeping. It’s my attempt to honour her memory and ease the… Read more →
With the successful transfer of ownership of Organize Series, and less time to manage my Digital Ocean droplet for my blog, I decided to transfer hosting of unfoldingneurons.com to WordPress.com. Besides removing the need for me to maintain a server, this also allows me to experience the best work my colleagues do and experience all… Read more →
For those who follow me on twitter you may recall a post I tweeted just over a year ago: My start date with Automattic was July 23, 2019. I fully intended on writing a followup to that tweet, but then got sucked into all kinds of fun stuff with my new responsibilities and posted in… Read more →
At various places so far in this series, you would have seen me use phrases like: I’ve also mentioned that I’d get to this mysterious “registry” reference later in the series. Well, here we are! What problem does the Registry solve? As a part of diving into what the registry is in the context of… Read more →
Now we have a resolver for asynchronously getting products via a REST api endpoint, we have some action creators, and we have a selector. We haven’t got to the reducer yet, but before we get to it, let’s consider another problem we haven’t addressed yet. When we update or create a product using our ui,… Read more →
The WordPress data module (or package) is a critical component of the new WordPress Editor as demonstrated by it’s implementation in (at the time of writing) 7 other WordPress packages: @wordpress/block-directory registers a store with the core/block-directory namespace. @wordpress/block-editor registers a store with the core/block-editor namespace. @wordpress/blocks registers a store with the core/blocks namespace. @wordpress/core-data… Read more →
Now that we have our new custom data store registered, we need to start integrating it with our example app. There are numerous ways in which you can interface with the data store in your components but I’m going to cover the four most common, straightforward ways. withSelect( mapToProps )( Component) withSelect is a higher… Read more →
In the exploration through wp.data, we’ve already created the necessary properties needed to register the custom products store for our example app. This includes, action creators, selectors, controls, and resolvers. Now it’s time to get to the last property we need for registering our store, and that’s the reducer. The reducer is arguably the most… Read more →
Before we took our side detour into learning about the controls property, I mentioned that since we now have a selector for getting products, it’d be good to implement a way to retrieve the products from the server. This is where resolvers come in. Let’s get started by creating a resolver for retrieving products. If… Read more →
In the previous post of this series, we took a brief interlude to take a look at an app that is using tree state to manage the data the app is using. We discovered that, while the app was functional, some potential problems with using state this way were beginning to surface. In this post,… Read more →
In the last post I gave you a quick overview of the api for registering a new data store. I mentioned that this next post would take a closer look at the individual properties of a store, but before we do that, let’s take a brief break and take a look at an app that… Read more →
The primary way in which you interact with state in wp.data is through a registered store. In this post we’re going to give an overview of the api for registering a store and then subsequent posts will dive into the specific components of the store config. registerStore( reducerKey, options ) Every data store found in… Read more →
To recap: so far in the series we’ve looked at the various properties of the configuration object for a store: selectors: which interface with the store for retrieving data from its state. actions: (actually action creators) which are used to dispatch action objects for handling by the reducer. reducer: which receives dispatched actions and determines… Read more →
Often with any sort of state in a given application, there can be times in an application’s lifecycle where you want to be able to execute some sort of logic as a part of the flow in setting state or updating state. A good example of this is asynchronous data flows between the client and… Read more →
The job of selectors is to provide an interface to access state from the registered data store. With wp.data this is the primary way that your store state is exposed and allows you to encapsulate logic surrounding exposing that data. For instance, let’s say you just want to store all products in the store state… Read more →