diff --git a/app/components/autocomplete/slash_suggestion/app_command_parser/app_command_parser.ts b/app/components/autocomplete/slash_suggestion/app_command_parser/app_command_parser.ts index 5a577aff8..8a6ca9a88 100644 --- a/app/components/autocomplete/slash_suggestion/app_command_parser/app_command_parser.ts +++ b/app/components/autocomplete/slash_suggestion/app_command_parser/app_command_parser.ts @@ -912,6 +912,9 @@ export class AppCommandParser { } setChannelContext = (channelID: string, rootPostID?: string) => { + if (this.channelID !== channelID || this.rootPostID !== rootPostID) { + this.forms = {}; + } this.channelID = channelID; this.rootPostID = rootPostID; } @@ -1000,14 +1003,17 @@ export class AppCommandParser { } getForm = async (location: string, binding: AppBinding): Promise<{form?: AppForm; error?: string} | undefined> => { - const form = this.forms[location]; + const rootID = this.rootPostID || ''; + const key = `${this.channelID}-${rootID}-${location}`; + const form = this.forms[key]; if (form) { return {form}; } + this.forms = {}; const fetched = await this.fetchForm(binding); if (fetched?.form) { - this.forms[location] = fetched.form; + this.forms[key] = fetched.form; } return fetched; }