DEV: Preload prompt list on component initialization (#165)

This commit is contained in:
Keegan George 2023-08-28 12:22:44 -07:00 committed by GitHub
parent 6e01b2c334
commit b470692409
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -62,6 +62,15 @@ export default class AiHelperContextMenu extends Component {
@tracked _dEditorInput; @tracked _dEditorInput;
@tracked _contextMenu; @tracked _contextMenu;
constructor() {
super(...arguments);
// Fetch prompts only if it hasn't been fetched yet
if (this.helperOptions.length === 0) {
this.loadPrompts();
}
}
willDestroy() { willDestroy() {
super.willDestroy(...arguments); super.willDestroy(...arguments);
document.removeEventListener("selectionchange", this.selectionChanged); document.removeEventListener("selectionchange", this.selectionChanged);