Skip to content

Commit

Permalink
Merge pull request #2278 from sul-dlss/2175-sidebar-load
Browse files Browse the repository at this point in the history
fix sidebar load for cached pages
  • Loading branch information
peetucket authored Dec 17, 2024
2 parents 654870f + c017fd6 commit 54d086e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/javascript/controllers/media_tag_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ export default class extends Controller {
fileLabel: dataset.fileLabel || '' }
})

window.dispatchEvent(new CustomEvent('thumbnails-found', { detail: thumbnails }))
// Timeout is set because when the page is cached, the event fires before the content_list_controller is mounted.
// This causes the sidebar not to load: https://github.com/sul-dlss/sul-embed/issues/2175
setTimeout(() => {
window.dispatchEvent(new CustomEvent('thumbnails-found', { detail: thumbnails }))
}, "100");
}

// Open the login window in a new window and then poll to see if the auth credentials are now active.
Expand Down

0 comments on commit 54d086e

Please sign in to comment.