Skip to content

Commit

Permalink
Fix bugs in ViewRefactor feature branch (#362)
Browse files Browse the repository at this point in the history
* Remove redundant state check method

* Fix bugs in view refactor branch

* Fix checkstyle issues

* Make webview asset provider disposal more selective
  • Loading branch information
taldekar authored Feb 19, 2025
1 parent 035feae commit f3d1862
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public void completed(final ProgressEvent event) {
}
});

if (!content.isPresent()) {
content = webViewAssetProvider.getContent();
}
browser.setText(content.get());
} else {
updateBrowser(browser);
}
Expand Down Expand Up @@ -113,11 +117,6 @@ public void completed(final ProgressEvent event) {
}
});

if (!content.isPresent()) {
content = webViewAssetProvider.getContent();
}
browser.setText(content.get());

setupAmazonQCommonActions();

return parent;
Expand Down Expand Up @@ -146,13 +145,17 @@ public final void onSendToChatUi(final String message) {
});
}

public final void disposeBrowserState() {
canDisposeState = true;
}

@Override
public final void dispose() {
chatCommunicationManager.removeListener();
if (canDisposeState) {
ChatStateManager.getInstance().dispose();
webViewAssetProvider.dispose();
}
webViewAssetProvider.dispose();
super.dispose();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ private void updateChildView() {
BaseAmazonQView newView = views.get(activeViewType);

if (currentView != null) {
if (currentView instanceof AmazonQChatWebview) {
((AmazonQChatWebview) currentView).disposeBrowserState();
}
Control[] children = parentComposite.getChildren();
for (Control child : children) {
if (child != null && !child.isDisposed()) {
Expand Down

0 comments on commit f3d1862

Please sign in to comment.