-
Notifications
You must be signed in to change notification settings - Fork 295
Project Scoping: Offline Support #1600
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
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3395952
Offline support project
bgrgicak f6e068a
Remove header
bgrgicak ed237e1
Update projects/in-progress/2024-07-11-offline-support.md
bgrgicak 2d32a2a
Update projects/in-progress/2024-07-11-offline-support.md
bgrgicak fa385f1
Update progress
bgrgicak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
### Problem we are solving | ||
|
||
Playground can't be used while offline. | ||
|
||
### Solution | ||
|
||
We can make Playground available offline after visiting the Playground.WordPress.net website or installing it as a PWA. | ||
|
||
### Project Goal | ||
|
||
Allow anyone to use WordPress while offline without a complicated setup. | ||
|
||
### Use Cases | ||
|
||
This will enable building offline first WordPress apps. | ||
|
||
Apps like SPAs and mobile apps that use WordPress as a backend will be able to embed the entire backend in the app and not rely on a server. | ||
|
||
### Limitations | ||
|
||
We will need to limit the switching of PHP and WordPress versions while offline to ensure users don't download too much data on the first load. | ||
|
||
## Project plan | ||
|
||
We plan to start by adding PWA support to Playground which will allow users to install it as an app and use it while online. | ||
|
||
After that, we need to ensure all assets are available after the first load which will make Playground available offline. | ||
|
||
Once Playground works offline we need to restrict some features like version switching while offline and add tests to ensure offline keeps working long-term. | ||
|
||
## Development | ||
|
||
- [x] [PWA support](https://github.com/WordPress/wordpress-playground/pull/1086) | ||
- [ ] [Separate manifest.json files for each environment](https://github.com/WordPress/wordpress-playground/pull/1615) | ||
- [x] [Backfill remote WordPress assets](https://github.com/WordPress/wordpress-playground/pull/1532) | ||
- [ ] Backfill Playground assets | ||
- [x] [Generate a list of assets to cache](https://github.com/WordPress/wordpress-playground/pull/1573) | ||
- [ ] [Cache Playground assets to enable offline support ](https://github.com/WordPress/wordpress-playground/pull/1535) | ||
- [x] [Add cache version number](https://github.com/WordPress/wordpress-playground/pull/1541) | ||
- [x] [Set web worker startup options with messages instead of query strings](https://github.com/WordPress/wordpress-playground/pull/1574) | ||
- [ ] Cache Playground static fetch requests | ||
- [ ] Offline e2e tests | ||
- [ ] Ensure tests run on a preview version of Playground | ||
- [x] [Limit features while offline](https://github.com/WordPress/wordpress-playground/pull/1607/files) | ||
|
||
## Notes | ||
|
||
- [Prototype](https://github.com/WordPress/wordpress-playground/pull/1483) | ||
- [Project issue](https://github.com/WordPress/wordpress-playground/issues/133) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
There are two ways assets can be backfilled.
When the site requests an asset we can cache it using a service worker.
This method is preferred because it avoids maintaining a list of files to download.
The challenge is that it can start only after the service worker loads.
To start loading data as early as possible we will move
registerServiceWorker
to run beforespawnPHPWorkerThread
inpackages/playground/remote/src/lib/boot-playground-remote.ts
.We can cache files from a static list when the Playground boots.
This could happen at the same time when we download WordPress assets.
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.
I did this in #1606 and can confirm that it will allow us to load WordPress and PHP assets without backfilling. This will make the implementation simpler because the backfill script won't need to know what's the current PHP and WP version.
Most other items will need to be backfilled.
Here is an example of how items load with #1606
First load
/favicon.ico
/worker-thread-5bd5ae4a.js
/assets/sqlite-database-integration-fd6f4063.zip
/assets/wp-6.5-264f1631.zip
/assets/php_8_0-a8925787.js
/assets/php_8_0-3584e351.wasm
/src/fonts/1258fcda79d43bef/inter_Inter-Regular.woff
/src/fonts/f86c32ba0f42a842/inter_Inter-SemiBold.woff
/src/fonts/8efb053b450b4a72/inter_Inter-Medium.woff
/src/fonts/62c967bbd6d11106/inter_Inter-Light.woff
/avatar/e6d67fed862c439aa6e911ce49c7857d
Second load
Cache miss
/gtag/js
/assets/index-9b5e396e.js
/assets/modulepreload-polyfill-3cfb730f.js
/assets/preload-helper-cf010ec4.js
/assets/index-d60708af.css
/assets/main-7bf730a2.css
/g/collect
/remote.html
/assets/wordpress-c3703a25.js
/assets/remote-b5d5f2da.css
Cache hit
/favicon.ico
/worker-thread-5bd5ae4a.js
/assets/sqlite-database-integration-fd6f4063.zip
/assets/wp-6.5-264f1631.zip
/assets/php_8_0-a8925787.js
/assets/php_8_0-3584e351.wasm
/src/fonts/1258fcda79d43bef/inter_Inter-Regular.woff
/src/fonts/f86c32ba0f42a842/inter_Inter-SemiBold.woff
/src/fonts/8efb053b450b4a72/inter_Inter-Medium.woff
/src/fonts/62c967bbd6d11106/inter_Inter-Light.woff
/avatar/e6d67fed862c439aa6e911ce49c7857d
/g/collect