apache / incubator-kie-issues

Apache License 2.0
12 stars 1 forks source link

chrome-extension: Kogito icon is not working correctly after using the browser "back" #130

Open ljmotta opened 1 year ago

ljmotta commented 1 year ago

The Kogito icon becomes inaccessible after using the browser "back" in a bpmn/dmn file in the bpmn/dmn chrome-extension. Also, opening a bpmn/dmn file after the browser "back" a second Kogito icon will appear.

https://user-images.githubusercontent.com/24302289/222573699-7e2eaf56-f487-4e6b-9127-515b8139f32d.mp4


https://user-images.githubusercontent.com/24302289/222573716-a0864b7d-f438-4c00-8067-40495bb4e139.mp4

yesamer commented 1 year ago

It seems the bug is still present, but it's slightly different. Now, every time you go back, a new icon is added.

https://github.com/kiegroup/kie-issues/assets/16005046/0eb652a1-724f-45ae-a90b-247556172b87

kbowers-ibm commented 7 months ago

As detailed above, the problem was two-fold: Problem 1) The kogito icon was being rendered multiple times when the back button was pressed. This was happening because GitHub caches DOM structures between changes of history. Solution 1) This has been addressed by adding a cleanup function in the utils.ts which removes any existing elements from the DOM before rendering new ones(which was already used elsewhere in the application to address this problem happening with other components).

Problem 2) The kogito icon was being rendered, but was un-interactable. This was happening due to an error where we were trying to "insertAdjacentHtml" to elements that hadn't been rendered yet. Solution 2) Fixed by making the affected function async, and only attempt to render once the element was available. (Similar to the SingleEditorView.ts)

Bugs found while testing: https://github.com/apache/incubator-kie-issues/issues/899 https://github.com/apache/incubator-kie-issues/issues/900