wordpress-mobile / wordpress-mobile/WordPress-Android

Unexpected API responses from GET requests within the Gutenberg editor

Open
#21,034 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

[Type] Bug Gutenberg
Dominant language
Kotlin
Stars
3.2k
Forks
1.4k
Avg merge
1d 11h
Merged PRs (30d)
69

Description

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.

  • Open the editor
  • Once the editor attempts to fetch the themes endpoint it stops working, you can edit or add new content.
Tested on Samsung Galaxy A23 5G, Android 14, JPAndroid / WPAndroid 25.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with executeWPAPIRequest in fluxc/src/main/java/org/wordpress/android/fluxc/store/ReactNativeStore.kt, then reproduce the editor startup request on a self-hosted site without Jetpack or Gutenberg. Trace the 401 response, nonce retry, and /themes call. Done means the Gutenberg editor can successfully make the GET request without stopping or crashing.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin, react-native
Domain
api, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.