Skip to content

chore: add function to refetch latencies to ProxyContext #7769

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 6 commits into from
Jun 1, 2023

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Jun 1, 2023

The button when clicked is async, so maybe we need to add some sort of loading wheel or something?

Screenshot from 2023-06-01 09-16-38

@Emyrk Emyrk requested a review from BrunoQuaresma June 1, 2023 13:17
@Emyrk Emyrk marked this pull request as ready for review June 1, 2023 13:17
// This fetchNumber is used to trigger a refetch of the proxy latencies.
const [fetchNumber, setFetchNumber] = useState(0)
const refetch = (): void => {
setFetchNumber(fetchNumber + 1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

this name is ok, but I would do something like this:

const [latestFetchRequest, setLatestFetchRequest] = useState(new Date().toISOString())

const refetch = () => {
  setLatestFetchRequest(new Date().toISOString())
}

I think this is a bit better because we can display the latest time the latency was checked if we want to and the naming is easier to reason about but it is up to you.

Copy link
Member Author

Choose a reason for hiding this comment

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

Each latency report has the date it was checked. I was thinking about adding an integer counter so the FE can tell if the latency provided is the latest one requested. But I figured if we want to add UI flair, we can implement it then.

I will update the name, and make it a date, but won't do anything with the date for now.

Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma left a comment

Choose a reason for hiding this comment

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

Just one minor suggestion.

@Emyrk Emyrk enabled auto-merge (squash) June 1, 2023 13:32
@Emyrk Emyrk merged commit b32ed2d into main Jun 1, 2023
@Emyrk Emyrk deleted the stevenmasley/refresh_latency branch June 1, 2023 13:37
@github-actions github-actions bot locked and limited conversation to collaborators Jun 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants