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: move precache route handler to reenable navigation handler on login redirects [LIBS-473] #809

Merged
merged 1 commit into from
May 16, 2023

Conversation

KaiVandivier
Copy link
Contributor

@KaiVandivier KaiVandivier commented May 16, 2023

Implements LIBS-473

The routing for the "plugin precache manifest" seems to be interfering with the route to handle navigation events, which prevents the service worker from passing redirect responses to the client when the user is unauthenticated. This results in seeing the login modal when visiting a PWA app while logged out, instead of being redirected to the login page

Moving the plugin precache route handler to come after the navigation handler lets the nav. route handler send redirects to the client, letting the login page be shown correctly

Test

This can be tested by checking out this branch and building the PWA example app:

yarn build:pwa && yarn build:adapter && yarn build:pwa-app

Then, upload the example PWA app to an instance and visit the app. Make sure the PWA app is installed or updated -- check the user profile menu for more information.

Log out or delete the session cookie, then visit the app URL. If it's successful, you should be redirected to the login page, instead of seeing a login modal at the PWA app URL

@KaiVandivier KaiVandivier requested a review from a team May 16, 2023 11:54
@KaiVandivier KaiVandivier merged commit 1ff29b6 into master May 16, 2023
14 checks passed
@KaiVandivier KaiVandivier deleted the libs-473-fix-login-redirect branch May 16, 2023 14:40
dhis2-bot added a commit that referenced this pull request May 16, 2023
## [10.3.9](v10.3.8...v10.3.9) (2023-05-16)

### Bug Fixes

* move precache route to reenable navigation handler on login redirects [LIBS-473] ([#809](#809)) ([1ff29b6](1ff29b6))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 10.3.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

dhis2-bot added a commit that referenced this pull request Aug 10, 2023
# [10.4.0-alpha.3](v10.4.0-alpha.2...v10.4.0-alpha.3) (2023-08-10)

### Bug Fixes

* move precache route to reenable navigation handler on login redirects [LIBS-473] ([#809](#809)) ([1ff29b6](1ff29b6))
* **pwa:** avoid crashing when SW is not available [LIBS-499] ([#807](#807)) ([b681022](b681022))
* omit `moment-locales` from precache ([#806](#806)) ([c8d5494](c8d5494))
* **cli:** fix envs to fix plugins in dev ([#799](#799)) ([ba29cea](ba29cea))
* **plugins:** omit launch paths when unused [LIBS-477] ([#791](#791)) ([e49a51f](e49a51f))
* **pwa:** bump ui version for headerbar connection status [LIBS-315] ([#797](#797)) ([61ff0a4](61ff0a4))
* make loading placeholders transparent ([#795](#795)) ([6e64756](6e64756))
* **plugins:** inject precache manifest correctly ([#792](#792)) ([c0d172e](c0d172e))
* **pwa:** add config option to omit files from precache [LIBS-482] ([#793](#793)) ([d089dda](d089dda))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 10.4.0-alpha.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

3 participants