Skip to content

Persist new workspace contextURL on org change #17209

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

Merged
merged 1 commit into from
Apr 14, 2023

Conversation

selfcontained
Copy link
Contributor

@selfcontained selfcontained commented Apr 13, 2023

Description

This PR aims to maintain the context url from the new workspace page even as the org changes.

As the context url changes, this gets set in the url hash now, and the org switcher links have a special case to handle if we're on the /new route so that state from the url is maintained.

Considerations

I would have liked a solution that didn't require a special case for the org switching urls, but considering other approaches of trying to track the state of the new workspace page, and persist/reload it in the right places, this felt simpler. I also opted to not try and maintain the other values on that form (the ide and ws class). We could explore tracking those as well (as query params maybe?) in a followup.

Related Issue(s)

Fixes WEB-120

How to test

Preview Env: https://bmh-keep-c7205484caf.preview.gitpod-dev.com/new/#https://github.com/gitpod-io/gitpod

  • Create at least a second org.
  • Visit the new workspace page, select a repo.
  • Change your org.
  • Verify you're still on the new workspace page, same context url set, and new org selected.

Risk

Low risk. This page is only enabled internally, and is unlikely to break existing behavior on the create new workspace page.

Release Notes

NONE

Documentation

Build Options:

  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish Options
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer Options
  • with-dedicated-emulation
  • with-ws-manager-mk2
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated

Preview Environment Options:

  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh

/hold

@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-bmh-keep-context-url-org-change.1 because the annotations in the pull request description changed
(with .werft/ from main)

@selfcontained selfcontained marked this pull request as ready for review April 13, 2023 18:11
@selfcontained selfcontained requested a review from a team April 13, 2023 18:11
@selfcontained selfcontained requested a review from gtsiolis as a code owner April 13, 2023 18:11
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Apr 13, 2023
Copy link
Member

@svenefftinge svenefftinge left a comment

Choose a reason for hiding this comment

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

LGTM

const handleContextURLChange = useCallback(
(newContextURL: string) => {
setContextURL(newContextURL);
history.replace(`#${newContextURL}`);
Copy link
Member

Choose a reason for hiding this comment

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

nice improvement 🎉

@svenefftinge
Copy link
Member

/unhold

@roboquat roboquat merged commit 8fe91c7 into main Apr 14, 2023
@roboquat roboquat deleted the bmh/keep-context-url-org-change branch April 14, 2023 07:14
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/M team: webapp Issue belongs to the WebApp team
Projects
Status: In Validation
Development

Successfully merging this pull request may close these issues.

3 participants