You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "kbowers-ibm (via GitHub)" <gi...@apache.org> on 2024/02/05 15:26:04 UTC
Re: [PR] kie-issues#130: chrome-extension: Kogito icon is not working correctly after using the browser "back" [incubator-kie-tools]
kbowers-ibm commented on code in PR #2134:
URL: https://github.com/apache/incubator-kie-tools/pull/2134#discussion_r1478432766
##########
packages/chrome-extension/src/app/utils.ts:
##########
@@ -161,3 +162,13 @@ export function waitForElementToBeReady(selector: string) {
});
});
}
+
+// Necessary because GitHub apparently "caches" DOM structures between changes on History.
+// Without this method you can observe duplicated elements when using back/forward browser buttons.
+export function cleanupDuplicateElements(id: string, selectors: string[]) {
+ selectors.forEach((selector) => {
+ Array.from(document.querySelectorAll(`.${selector}.${id}`)).forEach((e) => {
+ removeAllChildren(e);
+ });
+ });
+}
Review Comment:
Good point thanks Luiz, will update it accordingly
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org