-
Notifications
You must be signed in to change notification settings - Fork 67
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
chore(ui): add feedback_replace to ui, update listeners w/ feedback_type
#2804
Conversation
Preview this PR with FeatureBee: https://beta.wandb.ai/?betaVersion=72873893e98fe38f4508d3b2b65bddab746a255a |
.../src/components/PagePanelComponents/Home/Browse3/pages/wfReactInterface/traceServerClient.ts
Outdated
Show resolved
Hide resolved
feedback_ref
annotation_ref
@@ -23,7 +25,13 @@ export class TraceServerClient extends DirectTraceServerClient { | |||
}> = []; | |||
private onDeleteListeners: Array<() => void>; | |||
private onRenameListeners: Array<() => void>; | |||
private onFeedbackListeners: Record<string, Array<() => void>>; | |||
// weave_ref -> feedback_ref -> callback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure what this means
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, you are talking about the keys of the nested structure
annotation_ref
feedback_type
@@ -94,7 +109,10 @@ export class TraceServerClient extends DirectTraceServerClient { | |||
|
|||
public feedbackCreate(req: FeedbackCreateReq): Promise<FeedbackCreateRes> { | |||
const res = super.feedbackCreate(req).then(createRes => { | |||
const listeners = this.onFeedbackListeners[req.weave_ref] ?? []; | |||
const feedbackTypeResolved = | |||
req.feedback_type ?? this.FEEDBACK_TYPE_DEFAULT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think feedback type is always required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it is, unfortunately because it always exists this now requires changes to the existing feedback listening stuff, working through that now
} | ||
return purgeRes; | ||
}); | ||
return res; | ||
} | ||
|
||
public feedbackReplace(req: FeedbackReplaceReq): Promise<FeedbackReplaceRes> { | ||
const res = super.feedbackReplace(req).then(replaceRes => { | ||
const feedbackTypeResolved = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here - always required, no?
this.onFeedbackListeners[feedbackTypeResolved] = {}; | ||
} | ||
if (!(weaveRef in this.onFeedbackListeners[feedbackTypeResolved])) { | ||
this.onFeedbackListeners[feedbackTypeResolved][weaveRef] = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
your comment says it is going to be // weave_ref -> feedback_type -> callback
. i think that comment is better than the reverse
const listeners = this.onFeedbackListeners[req.weave_ref] ?? []; | ||
const feedbackTypeResolved = | ||
req.feedback_type ?? this.FEEDBACK_TYPE_DEFAULT; | ||
const listeners = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for here and in replace, i think what you want to hit all the listeners for weave_ref + feedback_type AND weave_ref + ''.
04ded0c
to
005a165
Compare
Description
WB-21662
Add
feedback_replace
endpoint to the frontend code. Also, update the feedback listener functions to also account forfeedback_type
s. By default, the functionality should be the same, feedback without afeedback_type
in thepayload
should requery on mutation. However, now when registering a listener, you can pass an optionalfeedback_type
which will then only refresh when mutations affect feedback with thatfeedback_type
in the payload.Testing
How was this PR tested?