Skip to content

Chat: Add Suggestions#33264

Open
marker-dao wants to merge 8 commits intoDevExpress:26_1from
marker-dao:26_1_chat_buttongroup_design
Open

Chat: Add Suggestions#33264
marker-dao wants to merge 8 commits intoDevExpress:26_1from
marker-dao:26_1_chat_buttongroup_design

Conversation

@marker-dao
Copy link
Copy Markdown
Contributor

No description provided.

@marker-dao marker-dao self-assigned this Apr 14, 2026
@marker-dao marker-dao marked this pull request as ready for review April 14, 2026 14:58
@marker-dao marker-dao requested a review from a team as a code owner April 14, 2026 14:58
Copilot AI review requested due to automatic review settings April 14, 2026 14:58

This comment was marked as resolved.

@marker-dao marker-dao force-pushed the 26_1_chat_buttongroup_design branch from b125bca to c1a86d0 Compare April 14, 2026 15:11
Copilot AI review requested due to automatic review settings April 14, 2026 15:33

This comment was marked as resolved.

Copilot AI review requested due to automatic review settings April 14, 2026 16:02

This comment was marked as resolved.

@marker-dao marker-dao requested a review from a team as a code owner April 14, 2026 18:48
Copilot AI review requested due to automatic review settings April 14, 2026 20:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.

this._$element?.empty();
}

dispose(): void {
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestions.dispose() removes _$element but doesn’t clear/dispose _buttonGroup (it only sets _$element to undefined). Even if dxremove ends up disposing the widget, keeping a reference to the ButtonGroup instance can retain memory and makes the lifecycle less explicit. Consider calling clean() (or at least setting _buttonGroup = undefined) as part of dispose() so the internal state is fully released and can’t be used accidentally after disposal.

Suggested change
dispose(): void {
dispose(): void {
this.clean();

Copilot uses AI. Check for mistakes.
Comment on lines +134 to +136
// this.getSuggestionsElement = () => $();
this.getSuggestionsElement = () => this.instance._suggestions._$element;
this.getSuggestionItems = () => this.$element.find(`.${BUTTON_GROUP_ITEM_CLASS}`);
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test helper accesses this.instance._suggestions._$element, which reaches into Suggestions internals (including a field marked private in TypeScript). This is brittle and can break if the implementation changes (e.g., renaming the field or switching to #private). Prefer querying the DOM for the suggestions container (e.g. by a stable CSS class) or exposing a small public accessor on Suggestions/Chat specifically for tests.

Suggested change
// this.getSuggestionsElement = () => $();
this.getSuggestionsElement = () => this.instance._suggestions._$element;
this.getSuggestionItems = () => this.$element.find(`.${BUTTON_GROUP_ITEM_CLASS}`);
this.getSuggestionsElement = () => this.$element
.find(`.${BUTTON_GROUP_ITEM_CLASS}`)
.closest(`.${WIDGET_CLASS}`)
.first();
this.getSuggestionItems = () => this.getSuggestionsElement().find(`.${BUTTON_GROUP_ITEM_CLASS}`);

Copilot uses AI. Check for mistakes.
this.getMessageListEmptyView = () => this.$element.find(`.${CHAT_MESSAGELIST_EMPTY_VIEW_CLASS}`);
this.getFileUploader = () => FileUploader.getInstance(this.$element.find(`.${FILEUPLOADER_CLASS}`));
this.getAttachButton = () => Button.getInstance(this.$element.find(`.${CHAT_TEXT_AREA_ATTACH_BUTTON}`));
// this.getSuggestionsElement = () => $();
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a leftover commented-out helper (// this.getSuggestionsElement = () => $();). Since it’s not used anymore, removing it would avoid noise in this shared test setup.

Suggested change
// this.getSuggestionsElement = () => $();

Copilot uses AI. Check for mistakes.
Comment on lines +67 to +71
clean(): void {
this._buttonGroup?.dispose();
this._buttonGroup = undefined;
this._$element?.empty();
}
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestions.clean() disposes the ButtonGroup instance but leaves the ButtonGroup root CSS classes (e.g. dx-buttongroup, mode classes) on _$element. DevExtreme widgets typically do not remove root classes on dispose(), so after updateOptions(undefined/{}) the element will still look like a ButtonGroup, which contradicts the tests here and can leave incorrect styling when suggestions are cleared/reinitialized. Consider removing ButtonGroup-related classes/attributes from _$element (and optionally dx-chat-suggestions) when cleaning, so the element returns to a plain container state.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants