Skip to content

Commit

Permalink
fix: Redirect to workspaces page after creation (#309)
Browse files Browse the repository at this point in the history
This is just a quick fix so that the redirection is correct after creating a workspace - so that we make it to our minimal 'workspaces' page. Mainly so we have a path for testing / onboarding more people.

Unfortunately the NextJS pages are a bit tricky to test - we don't have infra for it because of the special pathing requirements - we can potentially bring in a library like [next-page-tester](https://github.com/next-page-tester/next-page-tester) and create a separate test directory like `pages_test` - but since we may pick up the RFC to move away from Next, it doesn't seem like a useful effort.

With this, creating a project lands on our minimal workspaces page, and the links on the Projects page correctly navigate to the minimal workspaces page.
  • Loading branch information
bryphe-coder committed Feb 17, 2022
1 parent dd36317 commit 9431c45
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion site/pages/projects/[organization]/[project]/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const CreateWorkspacePage: React.FC = () => {

const onSubmit = async (req: API.CreateWorkspaceRequest) => {
const workspace = await API.Workspace.create(req)
await router.push(`/workspaces/${workspace.id}`)
await router.push(`/workspaces/me/${workspace.name}`)
return workspace
}

Expand Down
4 changes: 2 additions & 2 deletions site/pages/projects/[organization]/[project]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ const ProjectPage: React.FC = () => {
{
key: "name",
name: "Name",
renderer: (nameField: string, data: Workspace) => {
return <Link href={`/projects/${organization}/${project}/${data.id}`}>{nameField}</Link>
renderer: (nameField: string) => {
return <Link href={`/workspaces/me/${nameField}`}>{nameField}</Link>
},
},
]
Expand Down

0 comments on commit 9431c45

Please sign in to comment.