Skip to content

Fix empty screen flash before nav on clicking project in top bar - #2156

Merged
david-crespo merged 1 commit into
mainfrom
fix-project-path
Apr 17, 2024
Merged

david-crespo merged 1 commit into
mainfrom
fix-project-path

Conversation

@david-crespo

@david-crespo david-crespo commented Apr 17, 2024 •

Copy link
Copy Markdown
Collaborator

I noticed some janky behavior on nav when I click the project in the top bar.

2024-04-16-project-click-bug.mp4

This was due to that link going to /projects/my-proj, which is not actually a real page in its own right: it does a client-side redirect to /project/my-proj/instances. In general our approach in cases like this (a parent route with a default child that we always redirect to) is to link directly to the default child.

But I noticed is that path builder is not set up to encourage the right choice. pb.project() went to /projects/my-proj because it is used in the construction of many other paths, even though we don't actually ever want to link there. So what I did here is pull out a projectBase helper function that is used as the base for other routes, and changed pb.project() to go straight to /projects/my-proj/instances. This fixes the flash on the link in the top bar.

The other thing I did that's sort of subtle is that I changed some calls to pb.instances() to pb.project() even though they return the same route. I wanted to go according to the semantics of the call site instead of what we know the resulting path to be. For example, if the user creates a project, we want to land on the project detail. That previously went to pb.instances() because that is the correct path to land on. But what we want to land on in that case is not necessarily project instances, it's whatever the project detail path happens to be, which in this case is project instances, but it may not be in the future.

@vercel

vercel Bot commented Apr 17, 2024 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
console ✅ Ready (Inspect) Visit Preview Apr 17, 2024 3:44am

@david-crespo
david-crespo enabled auto-merge (squash) April 17, 2024 03:48
@david-crespo
david-crespo merged commit 522d3ab into main Apr 17, 2024
@david-crespo
david-crespo deleted the fix-project-path branch April 17, 2024 03:50

This branch was successfully deployed

1 active deployment
Preview — 55d18916 Deployed Apr 17, 2024 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant