Skip to content
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

Offline mode (PWA) #133

Closed
danielbachhuber opened this issue Feb 13, 2023 · 13 comments · Fixed by #1535
Closed

Offline mode (PWA) #133

danielbachhuber opened this issue Feb 13, 2023 · 13 comments · Fixed by #1535
Assignees
Labels
[Aspect] Browser [Type] Enhancement New feature or request [Type] Exploration An exploration that may or may not result in mergable code [Type] Project

Comments

@danielbachhuber
Copy link
Member

danielbachhuber commented Feb 13, 2023

Please use the project scoping PR to discuss this feature

Network access on contributor days is always problematic.

Once we have something like #104, it would be helpful to have offline support for WordPress Playground. This way, a new contributor could download WordPress Playground once and then be able to use it for the rest of the day.

@adamziel
Copy link
Collaborator

adamziel commented Feb 14, 2023

If WordPress Playground was a Progressive Web App, it could be:

  • Used on a phone
  • Used for offline apps in general (like notes, cc @ellatrix)
  • Handy as a development environment
  • Downloaded once and used for the rest of the day (handy for Contributor Days on WordCamps where network access is always a problem)

Technically, this would require downloading all the WordPress assets that are currently now hosted on the server. Doing it in the background in idle time after the initial paint should be fine.

@adamziel adamziel changed the title Offline support for end users Playground PWA Jun 2, 2023
@adamziel adamziel added [Aspect] Browser [Type] Exploration An exploration that may or may not result in mergable code labels Jun 2, 2023
@adamziel adamziel mentioned this issue Jun 5, 2023
@adamziel adamziel changed the title Playground PWA Offline mode with Playground PWA (e.g. for contributor days) Nov 22, 2023
@adamziel adamziel changed the title Offline mode with Playground PWA (e.g. for contributor days) Offline mode (PWA) Nov 22, 2023
@adamziel adamziel added this to the Innovative Developer Tools milestone Feb 29, 2024
@bgrgicak bgrgicak self-assigned this Mar 1, 2024
@bgrgicak
Copy link
Collaborator

bgrgicak commented Mar 1, 2024

@adamziel I will explore this one and see if I can make any progress on it.

@bgrgicak bgrgicak moved this to Ready in Playground Board Mar 1, 2024
@bgrgicak
Copy link
Collaborator

bgrgicak commented Mar 5, 2024

I started by adding the Vite PWA plugin and configuring it.
The next step is to enable offline support and ensure it works in development and production.

@bgrgicak bgrgicak moved this from Ready to In progress in Playground Board Mar 6, 2024
@bgrgicak
Copy link
Collaborator

bgrgicak commented Mar 7, 2024

Playground loads only a part of WordPress on the first load. Other files are loaded as needed, we will need to find a way to preload all files for full offline support.

@adamziel
Copy link
Collaborator

adamziel commented Apr 27, 2024

The offline mode mostly works when we shipping a full, zipped WordPress release. That's what the PR previewer does, e.g. try previewing this PR. We could add a separate offline mode very easily just by using that full zip bundle and caching it in the Service Worker.

@bgrgicak
Copy link
Collaborator

bgrgicak commented Jun 5, 2024

After some discussion with @WordPress/playground-maintainers we create a list of tasks that should add offline and PWA support:

@bgrgicak
Copy link
Collaborator

bgrgicak commented Jun 6, 2024

Should Playground use browser storage and support networking as the default option when installed?

If yes, it would be great for us to add a site switcher because we can't modify the url.

bgrgicak added a commit that referenced this issue Jun 12, 2024
## Motivation for the change, related issues

We want to [make Playground available
offline](#133).
This PR is a first step and adds support for installing Playground as a
PWA. Offline support will be implemented separately.

## Implementation details

The PR adds a `manifest.json` file and loads it on the Playground
website. This allows browsers to install Playground as a PWA

## Testing Instructions (or ideally a Blueprint)

- Checkout this branch
- Open Playground in [a browser that supports PWA
installing](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Guides/Making_PWAs_installable#browser_support)
- Confirm that you can install Playground as a PWA
@adamziel
Copy link
Collaborator

Should Playground use browser storage and support networking as the default option when installed?

It would be handy, yes, but it's not a blocker.

@brandonpayton
Copy link
Member

Flush cache when Playground updates

I wasn't able to get to this today but plan to look at this tomorrow if you don't tackle it first, @bgrgicak.

@bgrgicak
Copy link
Collaborator

@adamziel has a PR for CLI offline support #1523

@bgrgicak
Copy link
Collaborator

In a future iteration of offline support, we could add a background check to see if there were any updates to Playground and update the cache with the latest version of Playground.

Today this will work on reload, but mobile and desktop apps aren't usually reloaded.

@adamziel adamziel linked a pull request Jul 3, 2024 that will close this issue
@adamziel adamziel removed a link to a pull request Jul 3, 2024
@adamziel adamziel linked a pull request Jul 3, 2024 that will close this issue
@bgrgicak
Copy link
Collaborator

bgrgicak commented Jul 4, 2024

I got offline support to work in the browser. Here is a list of all open PR that are required to make it work.

@bgrgicak bgrgicak moved this from In progress to Project: In Progress in Playground Board Jul 5, 2024
@bgrgicak
Copy link
Collaborator

Please share any future comments in this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Aspect] Browser [Type] Enhancement New feature or request [Type] Exploration An exploration that may or may not result in mergable code [Type] Project
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants