Skip to content

Commit

Permalink
fix: caching problem with PWA and login providers (#2873)
Browse files Browse the repository at this point in the history
Co-authored-by: Manuel Brandstetter <[email protected]>
  • Loading branch information
Resaki1 and brandstetterm authored Jul 14, 2023
1 parent 7eae264 commit 72921be
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
PUBLIC_URL=/
REACT_APP_PUBLIC_URL=/
REACT_APP_VERSION=$npm_package_version
REACT_APP_VERSION=$npm_package_version
11 changes: 5 additions & 6 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: Continuous Integration

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
merge_group:
types: [checks_requested]
workflow_run:
workflows: ["Package"]
branches: [ main ]
branches: [main]
types:
- completed

Expand Down Expand Up @@ -39,7 +39,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: '^1.18'
go-version: "^1.18"

- name: Build server
working-directory: ./server
Expand All @@ -62,13 +62,12 @@ jobs:
needs: test
uses: inovex/scrumlr.io/.github/workflows/package.yml@main


deploy_to_dev_cluster:
needs: package
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.user.login != 'dependabot[bot]' }}
uses: inovex/scrumlr.io/.github/workflows/deploy_to_dev_cluster.yml@main
secrets: inherit
with:
with:
frontend_image_tag: ${{ needs.package.outputs.frontend-image-tag }}
server_image_tag: ${{ needs.package.outputs.server-image-tag }}

Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ jobs:
name: Deploy Feature Branch
runs-on: self-hosted
if: "${{ (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' && github.event.label.name == 'Action: Deploy PR') || (github.event.action == 'labeled' && github.event.label.name == 'Action: Deploy PR')}}"
needs: [ build-frontend, build-server ]
needs: [build-frontend, build-server]
steps:

- name: checkout repository
uses: actions/checkout@v2

Expand Down Expand Up @@ -105,4 +104,3 @@ jobs:
helm uninstall scrumlr-main --namespace scrumlr-main --wait
helm dep up deployment/chart/
helm install scrumlr-main ./deployment/chart -f ./deployment/chart/env/dev.yaml --namespace scrumlr-main
6 changes: 3 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import {Actions} from "store/action";
import {Html} from "components/Html";
import {APP_VERSION_STORAGE_KEY} from "constants/storage";
import {saveToStorage} from "utils/storage";
// import * as serviceWorkerRegistration from "./serviceWorkerRegistration";
import {register} from "serviceWorkerRegistration";

import {SHOW_LEGAL_DOCUMENTS} from "./config";
import "react-tooltip/dist/react-tooltip.css";

Expand All @@ -40,5 +41,4 @@ root.render(
);
store.dispatch(Actions.initApplication());

// Disable the service worker for now since there are known issues where our third party authentication services cannot be used
// serviceWorkerRegistration.register();
register();
15 changes: 6 additions & 9 deletions src/service-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,17 @@ registerRoute(
// Return false to exempt requests from being fulfilled by index.html.
({request, url}: {request: Request; url: URL}) => {
// If this isn't a navigation, skip.
if (request.mode !== "navigate") {
return false;
}
if (request.mode !== "navigate") return false;

// If this is a URL that starts with /_, skip.
if (url.pathname.startsWith("/_")) {
return false;
}
if (url.pathname.startsWith("/_")) return false;

// If this looks like a URL for a resource, because it contains
// a file extension, skip.
if (url.pathname.match(fileExtensionRegexp)) {
return false;
}
if (url.pathname.match(fileExtensionRegexp)) return false;

// if this URL is a login provider URL, skip
if (url.pathname.includes("/api/login/")) return false;

// Return true to signal that we want to use the handler.
return true;
Expand Down

0 comments on commit 72921be

Please sign in to comment.