wordpress-mobile / WordPress-Android

WordPress for Android
http://android.wordpress.org
GNU General Public License v2.0
2.96k stars 1.31k forks source link

Unexpected API responses from GET requests within the Gutenberg editor #21034

Open geriux opened 3 months ago

geriux commented 3 months ago

This issue tracks the investigations for the previously reported issue.

A recent change in Gutenberg caused the editor to make a GET API call to the /themes endpoint on start. This was causing a bug in the editor for sites without Jetpack and the Gutenberg plugin enabled, leading to crashes.

We decided to disable making /themes calls from Gutenberg until this issue is resolved. The problem seems to be related to how we handle these calls on the React Native side in executeWPAPIRequest.

Expected behavior

The editor should be able to make this call since it's a core endpoint.

Actual behavior

The editor is unable to successfully make a GET request to the themes endpoint when opened on sites without Jetpack or the Gutenberg plugin enabled.

It returns a 401 error with the message: Sorry, you are not allowed to view the active theme., then it tries to get a new nonce and call the endpoint again but it still fails.

Steps to reproduce the behavior

[!IMPORTANT]
Use a self-hosted site without Jetpack or the Gutenberg plugin enabled.

Tested on Samsung Galaxy A23 5G, Android 14, JPAndroid / WPAndroid 25.1
dangermattic commented 3 months ago

Thanks for reporting! 👍