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

chore(ui): add feedback_replace to ui, update listeners w/ feedback_type #2804

Closed
wants to merge 7 commits into from

Conversation

gtarpenning
Copy link
Member

@gtarpenning gtarpenning commented Oct 28, 2024

Description

WB-21662

Add feedback_replace endpoint to the frontend code. Also, update the feedback listener functions to also account for feedback_type s. By default, the functionality should be the same, feedback without a feedback_type in the payload should requery on mutation. However, now when registering a listener, you can pass an optional feedback_type which will then only refresh when mutations affect feedback with that feedback_type in the payload.

Testing

How was this PR tested?

@circle-job-mirror
Copy link

circle-job-mirror bot commented Oct 28, 2024

@gtarpenning gtarpenning marked this pull request as ready for review October 30, 2024 00:08
@gtarpenning gtarpenning requested review from a team as code owners October 30, 2024 00:08
@gtarpenning gtarpenning changed the title chore(ui): add feedback_replace to ui, update listeners w/ feedback_ref chore(ui): add feedback_replace to ui, update listeners w/ annotation_ref Nov 7, 2024
@@ -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
Copy link
Collaborator

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

Copy link
Collaborator

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

@gtarpenning gtarpenning changed the title chore(ui): add feedback_replace to ui, update listeners w/ annotation_ref chore(ui): add feedback_replace to ui, update listeners w/ feedback_type Nov 7, 2024
@gtarpenning gtarpenning requested a review from tssweeney November 7, 2024 21:50
@@ -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;
Copy link
Collaborator

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?

Copy link
Member Author

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 =
Copy link
Collaborator

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] = [];
Copy link
Collaborator

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 =
Copy link
Collaborator

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 + ''.

@gtarpenning gtarpenning force-pushed the griffin/feedback-replace-ts branch from 04ded0c to 005a165 Compare November 8, 2024 02:20
@gtarpenning gtarpenning requested a review from tssweeney November 8, 2024 18:55
@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2024
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