Skip to content

Commit ab1533c

Browse files
Added redirect logic to both QueryErrorBoundary.tsx (#21058)
1 parent 680dc0b commit ab1533c

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

components/dashboard/src/App.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ const App: FC = () => {
6666
}
6767

6868
// Redirect non-signed-in Gitpod Classic PAYG users from gitpod.io/# to app.ona.com/#
69+
// This provides redundancy with QueryErrorBoundary for better coverage
6970
const hash = getURLHash();
7071
if (!user && isGitpodIo() && location.pathname === "/" && hash !== "") {
7172
// Preserve the hash fragment when redirecting

components/dashboard/src/components/error-boundaries/QueryErrorBoundary.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,15 @@ const ExpectedQueryErrorsFallback: FC<FallbackProps> = ({ error, resetErrorBound
7373
return <QuickStart />;
7474
}
7575

76-
// Before we show a Login screen, check to see if we need to redirect to www site
77-
// Redirects if it's the root, no user, and no gp cookie present (has logged in recently)
78-
if (isGitpodIo() && window.location.pathname === "/" && window.location.hash === "") {
79-
// If there's no gp cookie, bounce to www site
76+
// Before we show a Login screen, check to see if we need to redirect
77+
if (isGitpodIo() && window.location.pathname === "/") {
78+
// If there's a hash fragment, redirect to app.ona.com preserving the hash
79+
if (window.location.hash !== "") {
80+
const hashFragment = window.location.hash;
81+
window.location.href = `https://app.ona.com/${hashFragment}`;
82+
return <div></div>;
83+
}
84+
// If there's no hash and no gp cookie, bounce to www site
8085
if (!hasLoggedInBefore()) {
8186
window.location.href = `https://www.gitpod.io`;
8287
return <div></div>;

memory-bank/activeContext.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Building a comprehensive knowledge base of the Gitpod codebase and architecture
1919
- Enhanced API component documentation with code generation information
2020
- Implemented server readiness probe with database, SpiceDB, and Redis connectivity checks
2121
- **Improved `registry-facade` resilience by implementing a comprehensive retry mechanism for blob retrieval, addressing transient network errors.**
22-
- **Implemented redirect for non-signed-in Gitpod Classic PAYG users from `gitpod.io/#` (with hash fragments) to `app.ona.com/#`, preserving hash fragments. Only applies to users with hash fragments, not all gitpod.io visitors.**
22+
- **Implemented redirect for non-signed-in Gitpod Classic PAYG users from `gitpod.io/#` to `app.ona.com/#`. Added redirect logic to both `QueryErrorBoundary.tsx` (primary path for authentication errors) and kept it in `App.tsx` (secondary path for defense in depth). This provides comprehensive coverage across different execution paths.**
2323

2424
## Next Steps
2525

0 commit comments

Comments
 (0)