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

[dashboard] Fix Arc favourites #20466

Merged
merged 3 commits into from
Jan 6, 2025
Merged

[dashboard] Fix Arc favourites #20466

merged 3 commits into from
Jan 6, 2025

Conversation

filiptronicek
Copy link
Member

Description

There's a funny bug that happened when you favorited the Gitpod Dashboard in Arc: when you open a favorited website, it does not want you to leave its origin and upon redirection to another one opens it in a new tab. This would be cool with us if we didn't try to redirect you on every workspace status update (spoiler alert: we do).

This PR stores a redirected property in the React state and prevents multiple redirects from happening. There's also a tiny piece of UI that tells you what happened if you end up back in the favorited tab, with buttons to more easily retry or get back to the dashboard.

image

Related Issue(s)

Fixes CLC-820

How to test

  1. Get Arc
  2. Favorite https://ft-fix-arc-redirects.preview.gitpod-dev.com/workspaces
  3. Try opening a workspace

/hold

@@ -458,11 +463,17 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
}

redirectTo(url: string) {
if (this.state.redirected) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

🫧 What are situations where we need to reset this value? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question: I'd say it's enough when React resets it when the page unmounts. On the page level, this prop should be permanent (or at least I don't see reasons why we'd forget about having redirected you somewhere).

@geropl
Copy link
Member

geropl commented Dec 19, 2024

@filiptronicek Can you re-deploy the preview pls? 🙏

@filiptronicek
Copy link
Member Author

@geropl aaah, it just broke. Let me deploy it now...

@filiptronicek
Copy link
Member Author

@geropl
Copy link
Member

geropl commented Dec 19, 2024

@filiptronicek I noted that I see the alert for a second before I'm effectively redirect. Not super important, but it talks about "probably opened in a new tab", while it gets replaced by the new content right after - which is a bit confusing.

Any ideas on how to avoid that? 🤔

@filiptronicek
Copy link
Member Author

@geropl: I noted that I see the alert for a second before I'm effectively redirect. Not super important, but it talks about "probably opened in a new tab", while it gets replaced by the new content right after - which is a bit confusing.

Any ideas on how to avoid that? 🤔

Great catch, I couldn't reproduce this myself but makes sense that it happens. I'm thinking of adding an additional prop that will trigger 2 seconds after we redirect, so that it's not there even before the UA gets the chance to properly redirect you.

@filiptronicek
Copy link
Member Author

We'll be merging this one after the New Year.

Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the meta: stale This issue/PR is stale and will be closed soon label Dec 30, 2024
@github-actions github-actions bot closed this Jan 5, 2025
@filiptronicek filiptronicek reopened this Jan 5, 2025
@filiptronicek filiptronicek marked this pull request as ready for review January 6, 2025 07:50
@axonasif
Copy link
Member

axonasif commented Jan 6, 2025

Hey @filiptronicek, happy new year! 🎉

Can we merge this now?

@filiptronicek
Copy link
Member Author

@axonasif HNY to you, too!

The PR is missing a review currently, but maybe @geropl can help with that :). I've just re-deployed the preview environment and am happy to pair on this if you want.

this.setState({ redirected: true });
setTimeout(() => {
this.setState({ showRedirectMessage: true });
}, 2000);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2s might be a tad too short, but let's see. Worked for me right now. 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wanted to find a threshold which was not too short to prevent races, but also not too long to actually show up in time to be useful to the user. Will leave as is for now

Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, tested and works!

@roboquat roboquat merged commit 0301b90 into main Jan 6, 2025
18 checks passed
@roboquat roboquat deleted the ft/fix-arc-redirects branch January 6, 2025 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants