-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash on the installation of a plugin that is already installed #18890
Conversation
📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
|
mIsInstallingPlugin = false; | ||
|
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.
Thank you for cleaning this up 👍 !
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.
Thanks for this fix @irfano , and also for improving the nearby code. The code changes look good. I tested this on a Pixel 3a (physical device), first by reproducing the crash on trunk
, and then confirming that it is fixed with this PR.
One observation I made: on trunk
, I was not able to reproduce the issue on case 1, but only on case 2. Also, on both trunk
and this PR, I observed that I had to leave the search screen and come back again to validate step 10 (i.e. I had to do step 4 twice 🤷♂️). Since this is not a regression (i.e. this PR fixes case 2 and does not introduce any new issue with step 1), I'm still approving. I just wanted to mention this, in case it was unexpected, or if it is a known existing issue.
Initially, I couldn't reproduce it either, but later on, it started happening. In any case, it has been fixed now.
Yes, I noticed that as well. The search screen needs to be updated after the plugin is installed. I will search for existing issues and open a new one for it. Thank you for the review and testing cases comprehensively. 🚀 |
Generated by 🚫 dangerJS |
Found 1 violations: The PR caused the following dependency changes:-+--- org.wordpress:fluxc:{strictly trunk-544130cbf7535c5cbcbcced125fc49f22befe3bb} -> trunk-544130cbf7535c5cbcbcced125fc49f22befe3bb
-| +--- org.wordpress:wellsql:2.0.0
-| | +--- androidx.annotation:annotation:1.2.0 -> 1.6.0 (*)
-| | \--- org.wordpress.wellsql:wellsql-annotations:2.0.0
-| +--- org.wordpress.fluxc:fluxc-annotations:trunk-544130cbf7535c5cbcbcced125fc49f22befe3bb
-| +--- org.greenrobot:eventbus:3.3.1
-| | \--- org.greenrobot:eventbus-java:3.3.1
-| +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.10.0 (*)
-| +--- com.android.volley:volley:1.1.1 -> 1.2.1
-| +--- androidx.paging:paging-runtime:2.1.2
-| | +--- androidx.paging:paging-common:2.1.2
-| | | +--- androidx.annotation:annotation:1.0.0 -> 1.6.0 (*)
-| | | \--- androidx.arch.core:core-common:2.0.0 -> 2.2.0 (*)
-| | +--- androidx.arch.core:core-runtime:2.0.0 -> 2.2.0 (*)
-| | +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.6.1 (*)
-| | +--- androidx.lifecycle:lifecycle-livedata:2.0.0 -> 2.6.1 (*)
-| | \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.3.0 (*)
-| +--- com.goterl:lazysodium-android:5.0.2
-| +--- net.java.dev.jna:jna:5.5.0
-| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20 -> 1.8.21 (*)
-| +--- org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.6.20 -> 1.8.21 (*)
-| +--- androidx.appcompat:appcompat:1.0.2 -> 1.6.1 (*)
-| +--- androidx.recyclerview:recyclerview:1.0.0 -> 1.3.0 (*)
-| +--- androidx.exifinterface:exifinterface:1.0.0 -> 1.3.6 (*)
-| +--- androidx.security:security-crypto:1.0.0
-| | +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*)
-| | \--- com.google.crypto.tink:tink-android:1.5.0
-| +--- com.squareup.okhttp3:okhttp-urlconnection:4.9.0 -> 4.9.2 (*)
-| +--- com.google.code.gson:gson:2.8.5 -> 2.10.1
-| +--- org.apache.commons:commons-text:1.10.0
-| | \--- org.apache.commons:commons-lang3:3.12.0
-| +--- androidx.room:room-runtime:2.4.2 -> 2.5.0
-| | +--- androidx.annotation:annotation-experimental:1.1.0 -> 1.3.0 (*)
-| | +--- androidx.arch.core:core-runtime:2.0.1 -> 2.2.0 (*)
-| | +--- androidx.room:room-common:2.5.0
-| | | +--- androidx.annotation:annotation:1.3.0 -> 1.6.0 (*)
-| | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.20 -> 1.8.21 (*)
-| | +--- androidx.sqlite:sqlite:2.3.0
-| | | +--- androidx.annotation:annotation:1.0.0 -> 1.6.0 (*)
-| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.7.20 -> 1.8.21 (*)
-| | \--- androidx.sqlite:sqlite-framework:2.3.0
-| | +--- androidx.annotation:annotation:1.2.0 -> 1.6.0 (*)
-| | +--- androidx.sqlite:sqlite:2.3.0 (*)
-| | \--- org.jetbrains.kotlin:kotlin-stdlib:1.7.20 -> 1.8.21 (*)
-| +--- androidx.room:room-ktx:2.4.2
-| | +--- androidx.room:room-common:2.4.2 -> 2.5.0 (*)
-| | +--- androidx.room:room-runtime:2.4.2 -> 2.5.0 (*)
-| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.10 -> 1.8.21 (*)
-| | \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2 -> 1.7.1 (*)
-| +--- com.google.dagger:dagger:2.42 -> 2.46.1
-| | \--- javax.inject:javax.inject:1
-| +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9 -> 1.7.1 (*)
-| \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9 -> 1.7.1 (*)
++--- org.wordpress:fluxc:{strictly trunk-b5b3d70cf01f082169bba319cf1ee2ff09787ea3} -> trunk-b5b3d70cf01f082169bba319cf1ee2ff09787ea3
+| +--- org.wordpress:wellsql:2.0.0
+| | +--- androidx.annotation:annotation:1.2.0 -> 1.6.0 (*)
+| | \--- org.wordpress.wellsql:wellsql-annotations:2.0.0
+| +--- org.wordpress.fluxc:fluxc-annotations:trunk-b5b3d70cf01f082169bba319cf1ee2ff09787ea3
+| +--- org.greenrobot:eventbus:3.3.1
+| | \--- org.greenrobot:eventbus-java:3.3.1
+| +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.10.0 (*)
+| +--- com.android.volley:volley:1.1.1 -> 1.2.1
+| +--- androidx.paging:paging-runtime:2.1.2
+| | +--- androidx.paging:paging-common:2.1.2
+| | | +--- androidx.annotation:annotation:1.0.0 -> 1.6.0 (*)
+| | | \--- androidx.arch.core:core-common:2.0.0 -> 2.2.0 (*)
+| | +--- androidx.arch.core:core-runtime:2.0.0 -> 2.2.0 (*)
+| | +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.6.1 (*)
+| | +--- androidx.lifecycle:lifecycle-livedata:2.0.0 -> 2.6.1 (*)
+| | \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.3.0 (*)
+| +--- com.goterl:lazysodium-android:5.0.2
+| +--- net.java.dev.jna:jna:5.5.0
+| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20 -> 1.8.21 (*)
+| +--- org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.6.20 -> 1.8.21 (*)
+| +--- androidx.appcompat:appcompat:1.0.2 -> 1.6.1 (*)
+| +--- androidx.recyclerview:recyclerview:1.0.0 -> 1.3.0 (*)
+| +--- androidx.exifinterface:exifinterface:1.0.0 -> 1.3.6 (*)
+| +--- androidx.security:security-crypto:1.0.0
+| | +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*)
+| | \--- com.google.crypto.tink:tink-android:1.5.0
+| +--- com.squareup.okhttp3:okhttp-urlconnection:4.9.0 -> 4.9.2 (*)
+| +--- com.google.code.gson:gson:2.8.5 -> 2.10.1
+| +--- org.apache.commons:commons-text:1.10.0
+| | \--- org.apache.commons:commons-lang3:3.12.0
+| +--- androidx.room:room-runtime:2.4.2 -> 2.5.0
+| | +--- androidx.annotation:annotation-experimental:1.1.0 -> 1.3.0 (*)
+| | +--- androidx.arch.core:core-runtime:2.0.1 -> 2.2.0 (*)
+| | +--- androidx.room:room-common:2.5.0
+| | | +--- androidx.annotation:annotation:1.3.0 -> 1.6.0 (*)
+| | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.20 -> 1.8.21 (*)
+| | +--- androidx.sqlite:sqlite:2.3.0
+| | | +--- androidx.annotation:annotation:1.0.0 -> 1.6.0 (*)
+| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.7.20 -> 1.8.21 (*)
+| | \--- androidx.sqlite:sqlite-framework:2.3.0
+| | +--- androidx.annotation:annotation:1.2.0 -> 1.6.0 (*)
+| | +--- androidx.sqlite:sqlite:2.3.0 (*)
+| | \--- org.jetbrains.kotlin:kotlin-stdlib:1.7.20 -> 1.8.21 (*)
+| +--- androidx.room:room-ktx:2.4.2
+| | +--- androidx.room:room-common:2.4.2 -> 2.5.0 (*)
+| | +--- androidx.room:room-runtime:2.4.2 -> 2.5.0 (*)
+| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.10 -> 1.8.21 (*)
+| | \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2 -> 1.7.1 (*)
+| +--- com.google.dagger:dagger:2.42 -> 2.46.1
+| | \--- javax.inject:javax.inject:1
+| +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9 -> 1.7.1 (*)
+| \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9 -> 1.7.1 (*)
\--- org.wordpress:login:1.4.0
- \--- org.wordpress:fluxc:2.21.0 -> trunk-544130cbf7535c5cbcbcced125fc49f22befe3bb (*)
+ \--- org.wordpress:fluxc:2.21.0 -> trunk-b5b3d70cf01f082169bba319cf1ee2ff09787ea3 (*)
Please review and act accordingly
|
Fixes #15144
This PR prevents the crash on the installation of a plugin that is already installed.
Before merging this,
Fix on FluxC
Before, FluxC was using the cached data for the plugins of the site. This caused showing the installed plugin as not installed and a crash when the user tried to re-install it.
After the fix, FluxC will always fetch and show the fresh data.
Fix on WPAndroid
Even though we disable caching the plugins, this case still can be created by:
To prevent this case,
InstallSitePluginErrorType .PLUGIN_ALREADY_INSTALLED
error type is caught on the app, and the new plugin state is fetched to update the screen.To test:
Case 1:
Case 2:
Regression Notes
Potential unintended areas of impact
Disabling caching could also disable storing the site plugins in db.
What I did to test those areas of impact (or what existing automated tests I relied on)
I checked the db and verified
SitePluginModel
table is still existing as before.What automated tests I added (or what prevented me from doing so)
"This crash can only be tested as a UI test, and I believe it is a too rare case to include it in the automated tests.
PR submission checklist:
RELEASE-NOTES.txt
if necessary.