Skip to content

[Website] Display ZIP import progress - #4176

Merged
adamziel merged 7 commits into
trunkfrom
adamziel/report-site-import-progress
Jul 27, 2026
Merged

[Website] Display ZIP import progress#4176
adamziel merged 7 commits into
trunkfrom
adamziel/report-site-import-progress

Conversation

@adamziel

@adamziel adamziel commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

#4168 reports progress between ZipArchive extraction batches. The website
still discarded those details and showed the same indeterminate viewport for
the entire import.

This PR keeps that progress in Redux and renders it in the site viewport. The
bar remains animated until the first non-zero update, then becomes determinate
and shows Extracting {processed}/{total} as its only status line. Ordinary
boot and import progress use the same LoadingViewport rendering path.

PHP executes synchronously inside its worker, so flush() alone cannot deliver
a progress line until execution returns. On PHP 7+, unzipFile() yields after
the first and final updates and no more than once every 50 ms between them.
Extraction still uses only ZipArchive; this PR adds no file-transfer,
metadata-scanning, or alternate ZIP-extraction path.

Before After
Desktop Indeterminate ZIP import loader on desktop ZIP extraction file count and determinate progress bar on desktop
Mobile Indeterminate ZIP import loader on mobile ZIP extraction file count and determinate progress bar on mobile

Testing

Open the website without storage=temp and import a ZIP containing thousands
of entries. Confirm the viewport changes from an animated bar to
Extracting {processed}/{total} with a determinate bar, then opens the imported
site. Reload and confirm the saved site remains available.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the “Preparing WordPress” loader to show the current ZIP import phase and a determinate percentage, replacing the previous indeterminate animation and boolean flag.

Changes:

  • Replace siteImportIsRunning with siteImportProgress carrying caption + progress details.
  • Dispatch/import progress updates from the ZIP import tracker and clear them when the site is ready.
  • Update loader UI (ARIA + determinate bar styling) and adjust Playwright coverage for ZIP import flow.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/playground/website/src/lib/state/redux/slice-ui.ts Replaces boolean import flag with ProgressDetails state and action.
packages/playground/website/src/lib/state/redux/site-management-api-middleware.ts Dispatches progress details during ZIP import and clears them when ready.
packages/playground/website/src/components/playground-viewport/style.module.css Adds determinate progress bar + details styling.
packages/playground/website/src/components/playground-viewport/index.tsx Renders determinate import progress (caption/percent) with ARIA attributes.
packages/playground/website/playwright/e2e/opfs.spec.ts Updates E2E test expectations to validate determinate import progress.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/playground/website/playwright/e2e/opfs.spec.ts Outdated
Comment thread packages/playground/website/playwright/e2e/opfs.spec.ts Outdated
@adamziel adamziel changed the title [Website] Report ZIP import phases and percentage Jul 27, 2026
@adamziel
adamziel force-pushed the adamziel/report-site-import-progress branch from ae1ee90 to 8da90f3 Compare July 27, 2026 15:02
@adamziel adamziel changed the title [Website] Report ZIP import progress in the site viewport Jul 27, 2026
@adamziel
adamziel force-pushed the adamziel/report-site-import-progress branch from 8da90f3 to 92bf1d2 Compare July 27, 2026 15:41
@adamziel
adamziel force-pushed the adamziel/report-site-import-progress branch from 67a0606 to 353fa0b Compare July 27, 2026 19:02
@adamziel
adamziel force-pushed the adamziel/report-site-import-progress branch from 4d67252 to 47a8592 Compare July 27, 2026 21:33
@adamziel
adamziel changed the base branch from trunk to adamziel/route-window-apis-through-messageports July 27, 2026 21:34
@adamziel
adamziel force-pushed the adamziel/report-site-import-progress branch 2 times, most recently from 1854148 to 48152a3 Compare July 27, 2026 21:50
adamziel added a commit that referenced this pull request Jul 27, 2026
Window-backed `consumeAPI()` connections now use `Window.postMessage()`
only
to request a dedicated Comlink `MessagePort`. Every later request and
response
uses that point-to-point port.

## Background

Window messages fan out to the application's main world and
browser-extension
isolated worlds. In Chromium 150, an isolated-world listener registered
first
could evaluate `event.data` and receive a transferred `ReadableStream`.
The
application listener was then skipped without receiving either `message`
or
`messageerror`.

Evernote Web Clipper 7.41.1 triggered this path. Its content script
evaluates
`event.data` in a `switch`. When `remote.html` returned a
`StreamedPHPResponse` containing headers, stdout, and stderr streams,
Evernote's
listener ran before Playground's Comlink listener. The parent-side
`runStream()` promise never resolved.

The saved-site importer had already copied the uploaded ZIP into PHP. It
then
waited for a streamed PHP response to scan the ZIP metadata, leaving the
UI at
`Reading archive, 45%`.

## This change

The Window bootstrap message transfers only Comlink's endpoint port.
Later API
messages, including transferred streams, travel through that port and
are not
visible to unrelated Window listeners. Chromium retains native stream
transfer;
Safari retains the existing MessagePort chunk protocol when its
capability
probe fails.

The browser regression test creates a Chromium isolated world, installs
its
listener first, and confirms that an iframe API stream still arrives
through a
native MessagePort transfer.

#4176 is stacked on this PR and adds measured ZIP-import progress.

## Testing

Import a large saved Playground with Evernote Web Clipper enabled and
several
other Playgrounds already stored in the browser. Confirm that the import
continues past `Reading archive` and survives a reload.

With 11 saved Playgrounds in the tested profile, a 135.9 MiB OPFS export
completed in 15.2 seconds. Its 134,217,728-byte file and PHP marker
remained
after reload.
Base automatically changed from adamziel/route-window-apis-through-messageports to trunk July 27, 2026 22:33
@adamziel
adamziel force-pushed the adamziel/report-site-import-progress branch from 48152a3 to 7a4473c Compare July 27, 2026 22:35
@adamziel adamziel changed the title [Website] Stream ZIP import progress into the site viewport Jul 27, 2026
@adamziel
adamziel merged commit 99b7828 into trunk Jul 27, 2026
53 checks passed
@adamziel
adamziel deleted the adamziel/report-site-import-progress branch July 27, 2026 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment