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

Add dropdown to instance breadcrumb #2392

Merged
merged 2 commits into from
Aug 20, 2024

Conversation

charliepark
Copy link
Contributor

@charliepark charliepark commented Aug 20, 2024

Closes #2380

We'll want to revisit the overall breadcrumb designs (see #2380 for a few possible directions / links to more in Figma), but in the interim, we can add the dropdown to the instance item in the breadcrumb nav.

Screenshot 2024-08-20 at 3 00 22 PM Screenshot 2024-08-20 at 3 01 49 PM

Copy link

vercel bot commented Aug 20, 2024

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

Name Status Preview Updated (UTC)
console ✅ Ready (Inspect) Visit Preview Aug 20, 2024 10:40pm

@david-crespo
Copy link
Collaborator

The CI failure was a flake, but both Chrome and Safari flaked on the same test, which has to do with instance states, so it most likely was caused by #2360. There's probably a timeout I can tweak that will fix it. I'll take a look.

@david-crespo david-crespo enabled auto-merge (squash) August 20, 2024 22:13
@david-crespo david-crespo disabled auto-merge August 20, 2024 22:24
@david-crespo
Copy link
Collaborator

Ok, this is amazing: that CI test failure is real, it's dead reproducible locally. The only thing this PR changes is it adds another query watching the instanceList endpoint. This might be interesting to debug.

onDelete: () => {
apiQueryClient.invalidateQueries('instanceList')
navigate(pb.instances(instanceSelector))
},
Copy link
Collaborator

@david-crespo david-crespo Aug 20, 2024

Choose a reason for hiding this comment

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

This was a legit bug, and I know why this change turned it up. The failure was that the expected disappearance of you-fail from the instance list was not happening.

What happens in this delete from instance detail test is:

  1. go to the instance detail page for you-fail
  2. delete it
  3. let it automatically land us on the list view
  4. confirm the instance is gone

Before this PR, there was nothing on the instance detail page "observing" the instanceList query, so when we nav to instance list on delete success, that query will always be fetched fresh because it is "new" from RQ's point of view. But with this PR, there is now the breadcrumb that uses the list of instances, so the query is "active" on the instance detail page.

Here is the funny bit: when you do what the test does by hand, you inevitably sit on the you-fail page longer than the 2 seconds required for the query to become stale. That means it will automatically refetch when the loader fires for the instance list page on navigation. But the test is faster than you, so it lands on the instance detail and hits delete in under 2 seconds, so the query is not stale by the time we land on the instance list and therefore does not refetch. I confirmed this theory by adding a sleep to the test so it sits on the page for 2 seconds before clicking delete. That makes the test pass! But of course the real fix is to specifically invalidate the instance list in the delete success callback.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, wow. Good sleuthing on this.

@david-crespo david-crespo merged commit 8dcddce into main Aug 20, 2024
8 checks passed
@david-crespo david-crespo deleted the add-dropdown-to-instance-breadcrumb branch August 20, 2024 22:50
export function InstancesPage() {
const { project } = useProjectSelector()

const queryClient = useApiQueryClient()
const refetchInstances = () => queryClient.invalidateQueries('instanceList')

Copy link
Collaborator

Choose a reason for hiding this comment

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

The changes in this file are irrelevant to the fix, but I did this while debugging and I like it better.

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.

Instance page breadcrumb needs a dropdown selector
2 participants