Skip to content

Fix dynamic REST caching and stalled iframe navigation - #4232

Draft
chubes4 wants to merge 3 commits into
WordPress:trunkfrom
chubes4:fix/4223-rest-cache-query-alias
Draft

Fix dynamic REST caching and stalled iframe navigation#4232
chubes4 wants to merge 3 commits into
WordPress:trunkfrom
chubes4:fix/4223-rest-cache-query-alias

Conversation

@chubes4

@chubes4 chubes4 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

What?

Fix two independent failure modes that can leave embedded Playground previews stale or permanently pending:

  • Skip offline-mode caching for WordPress REST API requests under /wp-json, whose query parameters determine dynamic responses.
  • Bound iframe navigation waits, remove stale listeners, and cancel navigation when the iframe never emits load.

Fixes #4223.
Fixes #4230.

Why?

The service worker currently uses ignoreSearch: true for cached requests. That is appropriate for static assets with cache-busting query parameters, but it aliases dynamic REST requests such as project-specific Blueprint endpoints.

Separately, goTo() currently has no failure path if iframe navigation stalls or the browser loses the load event. Because Blueprint v1 uses goTo() for its final redirect, an otherwise successful Blueprint can remain pending forever.

How?

  • Treat /wp-json requests as network-only in offline mode.
  • Extract iframe navigation waiting into a small helper with bounded timeout and cleanup.
  • Add focused regression tests for REST requests and successful, timed-out, and stale iframe navigation.

Testing

  • Focused Vitest suite: 4 tests passed.
  • playground-remote:typecheck passed.
  • playground-website:build:wasm-wordpress-net passed.
  • Downstream self-hosted runtime verification passed two fresh-browser runs covering cold imports and repeated OPFS project switching.

AI assistance

OpenAI gpt-5.6-sol via OpenCode assisted with investigation, implementation, tests, and downstream verification. Chris Huber reviewed the resulting changes.

AI assistance: OpenAI gpt-5.6-sol via OpenCode was used to review and implement the follow-up fixes and tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

goTo() can wait forever when iframe navigation never emits load Service worker aliases dynamic REST responses across query parameters

1 participant