chembl / GLaDOS

Web Interface for ChEMBL @ EMBL-EBI
https://www.ebi.ac.uk/chembl/
Other
44 stars 5 forks source link

Compound Report Card embeds don't update with hashchange events #1317

Open justin-john-sinequa opened 1 year ago

justin-john-sinequa commented 1 year ago

I noticed when embedding compound report cards, the embed will not update if you change the compound ID in the URL in the same tab. Instead, it keeps showing the content from the first loaded page. This happens even when cookies, local storage, and session storage are cleared.

The issue persists in both normal and incognito modes, and when changing the URL directly in the address bar. However, it doesn't occur when loading the page in a new tab, suggesting that it's related to the state of the current tab.

Refreshing the tab with the new URL does correctly load the new page, indicating that the issue might be with how the embed handles hashchange events.

Steps to reproduce:

  1. Open a browser tab and navigate to https://www.ebi.ac.uk/chembl/embed/#compound_report_card/CHEMBL1743050/name_and_classification.
  2. Once the page loads, change the URL in the address bar to https://www.ebi.ac.uk/chembl/embed/#compound_report_card/CHEMBL4085457/name_and_classification and hit enter.

Expected result: The page for CHEMBL4085457 should load.

Actual result: The page for CHEMBL1743050 remains visible, despite the URL change.

This behavior also manifests when embedding the pages in an iframe and changing the src attribute. The workaround of fully removing and recreating the iframe when changing the src attribute does correctly load the new page.

I created some small example HTML files to showcase the issue. examples.zip

Thanks