-
Notifications
You must be signed in to change notification settings - Fork 15
Fix update props and connectWpPost slug entity resolution #49
Conversation
Changes Unknown when pulling 60d2812 on fix-update-props into ** on master**. |
Changes Unknown when pulling efcbbd6 on fix-update-props into ** on master**. |
Changes Unknown when pulling 907bba9 on fix-update-props into ** on master**. |
Changes Unknown when pulling ed7e83a on fix-update-props into ** on master**. |
const entities = this._getState().wordpress.entities[typeConfig.plural] | ||
return entities[realId] || null | ||
|
||
for (let i = 0, len = keys.length; i < len; i++) { |
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.
As discussed earlier, can't we use the result of the query to know which ID(s) were returned, and then look them up in the entities array?
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.
Some content types, e.g. tag, don't have an id
so for these types we fall back on their slug
, and vice versa. Maybe there's a better way still?
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.
But this is part of KasiaConnectWpPostComponent
, so won't the data always be a post, so have an id?
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.
Ah, no, sorry... confusingly post is synonymous with content type here.
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.
Ah, I didn't realise that. In that case, this should do until (unless) we find a better solution
Changes Unknown when pulling a465d42 on fix-update-props into ** on master**. |
…/kasia into fix-update-props
Changes Unknown when pulling 07fb507 on fix-update-props into ** on master**. |
Fixes bugs identified in #44 by @olapersson that prevented component updating on changed props and connectWpPost components resolving entities by slug.
Extras: locks down deps,
shouldUpdate
can takestate
as third arg, small updates toREADME
, and others I have forgotten. 💯