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

fix: handle frozen page lifecycle state #1658

Merged
merged 17 commits into from
Feb 6, 2023

Conversation

userquin
Copy link
Member

@userquin userquin commented Feb 6, 2023

@danielroe just added the plugin, we'll need to close all database and wss connections : for reference check Frozen state here https://developer.chrome.com/blog/page-lifecycle-api/#developer-recommendations-for-each-state

closes #750
closes #1584

@stackblitz
Copy link

stackblitz bot commented Feb 6, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@netlify
Copy link

netlify bot commented Feb 6, 2023

Deploy Preview for elk-docs canceled.

Name Link
🔨 Latest commit 1153c3e
🔍 Latest deploy log https://app.netlify.com/sites/elk-docs/deploys/63e16a27f88383000827de00

@netlify
Copy link

netlify bot commented Feb 6, 2023

Deploy Preview for elk-zone ready!

Name Link
🔨 Latest commit 1153c3e
🔍 Latest deploy log https://app.netlify.com/sites/elk-zone/deploys/63e16a27d88a770008dfedde
😎 Deploy Preview https://deploy-preview-1658--elk-zone.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@userquin userquin marked this pull request as ready for review February 6, 2023 19:27
@userquin
Copy link
Member Author

userquin commented Feb 6, 2023

We need to resolve the TODO in page-lifecycle.client.ts plugin before merging this PR.

EDIT: maybe we can keep current code (just remove the comment and undo moving isPWAInstalled to its own module)

@edimitchel
Copy link
Collaborator

edimitchel commented Feb 6, 2023

Works fine on Android!

It seems this PR fixes Firefox problem:
https://cdn.discordapp.com/attachments/1048291491962953788/1072249681196896256/VID_20230206210938.mp4

shims.d.ts Outdated Show resolved Hide resolved
composables/pwa.ts Outdated Show resolved Hide resolved
@userquin
Copy link
Member Author

userquin commented Feb 6, 2023

Don't merge yet, we're preparing final test on iOS emulator to confirm it is working.

@userquin
Copy link
Member Author

userquin commented Feb 6, 2023

@danielroe this is ready, on iOS emulator, the prompt for update seems to be not working, but it works for new toots once the installed PWA minimized for 10 minutes.

@cyberalien
Copy link
Member

cyberalien commented Feb 6, 2023

Tested in iOS 16.2, app working normally, except for update as @userquin mentioned. Not seeing update notification anywhere.

edit: actually, not normally. Some menu items don't work: settings, lists, federated, local. After restarting phone everything started working again. Settings showed that app uses latest commit, so app was updated at some point without prompt (it was installed before last commit).

@userquin userquin marked this pull request as draft February 6, 2023 21:53
@userquin userquin marked this pull request as ready for review February 6, 2023 22:09
@cyberalien
Copy link
Member

Tested it again on localhost with https, everything works now. Even got PWA update notification.

Screenshot 2023-02-06 at 23 55 28

Though there was a weird error with update notification, but after clicking button to update app (had to click it twice - first click didn't do anything), got correct home page.

@danielroe danielroe merged commit 32cfe63 into main Feb 6, 2023
@danielroe danielroe deleted the userquin/fix-pwa-and-browser-lifecycle branch February 6, 2023 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants