fix(posts): use uniqueId as stkQueryId to ensure uniqueness even when…
… duplicated
fixes #3189
The problem arises from the stkQueryId attribute being also duplicated when the post block is duplicated. Only unique stkQueryId is assigned when new post blocks are created using useInstanceId.
Question: Is there a reason why in the previous implementation, uniqueId, which is always unique, was not used? If so, I can change the implementation to check all post blocks first before assigning stkQueryId to ensure uniqueness.
🤖 Pull request artifacts
| file | commit |
|---|---|
pr3289-stackable-3289-merge.zip |
61369fd19500f2aa3124abcafd0b519a5a057416 |
Try this Pull Request in the WordPress playground: https://playground.wordpress.net/?mode=seamless#{"landingPage":"/wp-admin/post-new.php?post_type=page","preferredVersions":{"php":"latest","wp":"latest"},"steps":[{"step":"login","username":"admin","password":"password"},{"step":"installPlugin","pluginZipFile":{"resource":"url","url":"https://raw.githubusercontent.com/gambitph/Stackable/artifacts/pr3289-stackable-3289-merge.zip"}}]}
Question: Is there a reason why in the previous implementation,
uniqueId, which is always unique, was not used? If so, I can change the implementation to check all post blocks first before assigningstkQueryIdto ensure uniqueness.
I believe that we were copying how it was done in the native posts block, where each post block has their own unique "instanceId" that is a marker so that query and pagination can be found when changing pages