Repository navigation
[RNMobile] Story block: added use of mediaFilesBlockReplaceSync bridge method - #18540
Conversation
|
Caution: This PR has changes that must be merged to WordPress.com |
|
Scheduled Jetpack release: February 16, 2021. Thank you for the great PR description! When this PR is ready for review, please apply the |
|
Note for the reviewers: I'm getting the following lint warning:
This is for this part of code: I think the code is good as is, because I actually intend for the side effect to be run when the clientId changes (as a matter of fact, I could as well just omit the clientId entirely given we know the block will still be running this side effect at first load anyway). But the linter is complaining (and possibly blocking?) the merge with this - leaving this comment here for discussion, I'm inclined to think the code should be fine as is and should be merged but open to suggestions and removing the array entirely if needed. |
Hi @mzorz I haven't looked into this in-depth as yet but I found this resource on Stack Overflow and it has several promising solutions https://stackoverflow.com/questions/55840294/how-to-fix-missing-dependency-warning-when-using-useeffect-react-hook Let me know if you have seen this before so I can determine if I need to dig in more and do some more research on the matter. |
Thank you for the pointers @jd-alexander ! I went ahead and added the linter skip directive given AFAIU we know what we're doing - unless the Jetpack crew team thinks otherwise when it gets on their plate to review 👍 |
jd-alexander
left a comment
There was a problem hiding this comment.
Thanks for these changes @mzorz LGTM 🚢
|
r221667-wpcom |
Changes proposed in this Pull Request:
This PR adds a new bridge method that allows the native side of things learn if a new clientId has been assigned to a newly loaded block that was edited externally.
Basically, when the signal to launch an external editor for Stories is sent, we save the current block's hash on the native side so we know which block we'll need to replace later on, after edits have taken place.
Then, when the Post is again loaded in Gutenberg (before applying edits), Gutenberg gives blocks new clientIds, so we need to take these and figure out which block matches which new edits. At this point, the new bridge method
mediaFilesBlockReplaceSyncgets called, and helps the native app identify whether this is in effect the block that needs to get replaced with new content or not.This only affects the native side of things. See related PRs:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
Proposed changelog entry for your changes: