[RNMobile] Add enableCaching param to fetch request on Android#31186
[RNMobile] Add enableCaching param to fetch request on Android#31186
enableCaching param to fetch request on Android#31186Conversation
|
Size Change: 0 B Total Size: 1.31 MB ℹ️ View Unchanged
|
93a3842 to
f549c32
Compare
| if ( isAndroid ) { | ||
| return RNReactNativeGutenbergBridge.fetchRequest( path, enableCaching ); | ||
| } |
There was a problem hiding this comment.
Request caching is only available on Android.
There was a problem hiding this comment.
Good approach since the bridge code on iOS does not contain enableCaching in the attached bridge code snippet and in the line below.
There was a problem hiding this comment.
Yep, actually, I was surprised that we have the caching feature only on Android 🤔 .
jd-alexander
left a comment
There was a problem hiding this comment.
Thanks for these changes @fluiddot I tested the behavior utilizing the WP Android PR with a local metro server ( the generated APK on the PR does not support reusable blocks since it's still devOnly ). Making changes to the reusable block's content on the web resulted in instant changes in the post when it was opened on mobile. I left a few comments I want to hear your thoughts on.
Thank you very much @jd-alexander for the review ❤️ ! Oh true, the reusable block is still devOnly so it can only be tested in development mode. I have a test branch (
Awesome! I've just pushed a commit with changes regarding your comments 👍 . |
I updated the test branch with the latest changes in case you want to use an installable build for testing. |
More than happy to 😄
Thanks! I am going to have a look 🙇🏾 |
gutenberg-mobilePR: wordpress-mobile/gutenberg-mobile#3419WordPress-AndroidPR: wordpress-mobile/WordPress-Android#14529Description
On Android the network requests coming from RN are always cached for 10 minutes, in most cases this behavior is ok but for content that can be modified often like the reusable blocks, we should have a way to bypass the cache.
For this purpose, I've added a param to the fetch request function that is exposed to RN and also add a constant with the endpoint patterns that shouldn't be cached when a network request is made. For now we'll only disable caching for the blocks (reusable blocks) endpoint.
How has this been tested?
Screenshots
N/A
Types of changes
New feature
Checklist:
*.native.jsfiles for terms that need renaming or removal).