-
Notifications
You must be signed in to change notification settings - Fork 349
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
fix: hide edit prompts on the web #6815
base: main
Are you sure you want to change the base?
Conversation
function isEditActionLike(action: Action): boolean { | ||
return action.actionType === 'prompt' ? action.mode !== 'CHAT' : action.mode !== 'ask' | ||
} |
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.
This function should either be defined outside the component or it should replace shouldShowAction
which you don't need anymore.
const filteredActions = isEditEnabled | ||
? actions | ||
: actions.filter(action => !isEditActionLike(action)) |
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 really would suggest to implement this as
if (!isEditEnabled) {
actions = actions.filter(action => !isEditActionLike(action))
}
Otherwise we have two variables in scope that represent actions (actions
and filteredActions
) and it seems too easy to make a mistake and reference actions
instead of filteredActions
below.
In the worst case you could accidentally do return actions
and throw away the whole filtering.
Of course we can also build just a single filter condition to avoid this, but that seems more tricky.
) | ||
|
||
// Don't show builtin commands to insert in the prompt editor. | ||
) // Don't show builtin commands to insert in the prompt editor. |
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.
Keep the empty line and the comment above the following line.
} | ||
const shouldExcludeBuiltinCommands = | ||
|
||
const hasCustomFilters = |
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.
The naming seems to imply that promptFilters.core
is not a custom filter. It's not clear to me what a 'custom filter' is in this case. I'd leave the name as before.
This PR completely hides edit prompts from the web client (where edits aren't possible).
Web
Client
No change.
Test plan
Manually tested, locally.