[Mobile] Use react-native-url-polyfill in globals#27867
Conversation
|
Size Change: 0 B Total Size: 1.3 MB ℹ️ View Unchanged
|
|
Change looks good to me, could we have a test as part of this change as well. If needed I can test that removing the import actually makes the test fail |
It turns out we already have several tests for url, which were passing spuriously. In a previous approach (before I realized we are already including this polyfill with our bundle, but not using it universally), we tried manually patching the This also explains why the unit tests did not break, even though the actual behavior in the app did break. I created this branch to demostrate that several |
|
This works as expected for me. Lets fix the conflict in the index.native.js file and ship this :) |
This platform fork is no longer necessary, since we are using the polyfill globally.
|
It seems the fixture tests for native were disabled when the native test file was deleted here. I've re-added the tests, and ensured we are testing against the polyfill implementation used in production with this PR. I've added some exclusions to the fixtures, since they've been updated in the same jest upgrade PR. Also, I removed the native fork of |
enejb
left a comment
There was a problem hiding this comment.
I tested this and it worked well for me. Thanks for the fixes!
|
Thanks for the review Enej, and for troubleshooting the CI issues with me. 😄 |
Related PR
gutenberg-mobile: wordpress-mobile/gutenberg-mobile#2923Description
Uses
react-native-url-polyfillvia import inglobals.js. This is needed for properly merging URL query parameters duing middleware processing for endpoints utilising api-fetch. We have already incurred the cost to the bundle size, since we are utilizing this module inis-url.native.js. This PR makes sure we are using the polyfill implementation globally.It seems that the unit tests we currently have for URL are not being run against the default URL implementation provided by the react-native runtime. I've opened a branch (#27868) for demonstration purposes to have the tests running with the default URL implementation, and several of the tests fail. I've also added logging for errors, which typically are caught and silently ignored. We can see here the failures arise from unimplemented getters.
This PR fixes this issue: wordpress-mobile/gutenberg-mobile#2922
Steps to test
Expected behavior
The results should be different for searches which have differerent queries. The search results should reflect the query being searched for.
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: