You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The key to our strategy for updating the store optimistically is understanding the data structure in advance. This allows us to populate the store precisely when a new item is created, anticipating its shape.
Let's examine the Attribute Terms store (/wc/admin/products/attributes/terms):
The image above shows the status of the store. It has four items:
data: contains the raw data
items: links the GET_ITEMS indexes with the raw data used by the selectors.
itemsCounts: it computes the number of items based on the data. It's used by counter-selectors
Now, let's suppose a new item is created, the response has the following shape:
Currently, when a new item is created, it's added to the store's data key. However, the items and itemsCounts keys are not updated. To address this, we need to update the implementation of these properties without triggering a new sync request (invalidate resolution).
The text was updated successfully, but these errors were encountered:
The key to our strategy for updating the store optimistically is understanding the data structure in advance. This allows us to populate the store precisely when a new item is created, anticipating its shape.
Let's examine the Attribute Terms store (
/wc/admin/products/attributes/terms
):The image above shows the status of the store. It has four items:
data
: contains the raw dataitems
: links theGET_ITEMS
indexes with the raw data used by the selectors.itemsCounts
: it computes the number of items based on the data. It's used by counter-selectorsNow, let's suppose a new item is created, the response has the following shape:
Currently, when a new item is created, it's added to the store's
data
key. However, theitems
anditemsCounts
keys are not updated. To address this, we need to update the implementation of these properties without triggering a new sync request (invalidate resolution).The text was updated successfully, but these errors were encountered: