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 the ability to replay requests from the details view #197

Merged
merged 31 commits into from
Aug 27, 2024
Merged

Conversation

keturiosakys
Copy link
Member

@keturiosakys keturiosakys commented Aug 26, 2024

Addresses FP-3855. This PR adds the ability to replay requests from the request details view.

To achieve this, we're adding 3 hooks:

  • useShouldReplay which should gate replayability only to json/text requests
  • useReplayRequest which enables replaying the request
  • useMostRecentRequest which informs the UI if the currently viewed request is the most recent one

TODO:

  • enable a keyboard shortcut cmd-enter to replay the request
  • fix up the type errors in useReplayRequest
  • uncomment the documentation regarding the "Replay" button

Of note: we've taken some shortcuts with regards to showing intermediate states while the request is loading or having some more robust interaction patterns in general. This is because there's explorative work in play that if validated will remove the request detail view in general in which case we shouldn't spend too much time on this.

@keturiosakys keturiosakys marked this pull request as ready for review August 26, 2024 18:07
Copy link

pkg-pr-new bot commented Aug 27, 2024

commit: 1144d4e

pnpm add https://pkg.pr.new/fiberplane/fpx/@fiberplane/studio@197
pnpm add https://pkg.pr.new/fiberplane/fpx/@fiberplane/hono-otel@197

Open in Stackblitz

@keturiosakys keturiosakys requested a review from oscarvz August 27, 2024 11:54
enabled: boolean;
}>,
) => {
const excludedHeaders = [
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could use Set

"user-agent",
"referer",
"origin",
"cookie",
Copy link
Contributor

Choose a reason for hiding this comment

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

sure we wanna filter out cookie?

Copy link
Contributor

Choose a reason for hiding this comment

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

if someone attached a cookie for example, this breaks auth.


const replayBody = useMemo(() => {
const body = getRequestBody(span);
try {
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to refactor, but for future reference, i made a utility for this kind of logic

utility is called isJson, should be importable from the utils module

Copy link
Contributor

@brettimus brettimus left a comment

Choose a reason for hiding this comment

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

some flakiness on getting the "view latest" cta to appear for me, but might be specific to running things locally + a stale websocket

only thing that'd be worth considering imo is how to deal with horizontal space on smaller-ish screens, like half of a laptop screen

shorter copy, smaller font, something of the like

@brettimus brettimus merged commit c974b9f into main Aug 27, 2024
4 checks passed
@brettimus brettimus deleted the replay branch August 27, 2024 15:26
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.

2 participants