Merge pull request #16409 from overleaf/dp-fix-group-pricing-after-back-button-pressed

Update group plan pricing modal after the page has fully loaded

GitOrigin-RevId: 03e2ea642b38d6e2e208683b0cb68a817a5873c8
This commit is contained in:
David 2024-01-08 10:38:47 +00:00 committed by Copybot
parent 17d17612b3
commit f6b7b84e88

View file

@ -136,14 +136,25 @@ document
})
})
const isGroupPlanModalAvailable = document.querySelector(
'[data-ol-group-plan-modal]'
)
function updateGroupModalPlanPricingIfAvailable() {
const isGroupPlanModalAvailable = document.querySelector(
'[data-ol-group-plan-modal]'
)
if (isGroupPlanModalAvailable) {
updateGroupModalPlanPricing()
if (isGroupPlanModalAvailable) {
updateGroupModalPlanPricing()
}
}
updateGroupModalPlanPricingIfAvailable()
// When using browser back buttons, we need to update the pricing plan
// after the page has fully loaded as we need to wait for the previously
// selected values to load for e.g. size.
window.addEventListener('load', () => {
updateGroupModalPlanPricingIfAvailable()
})
if (window.location.hash === '#groups') {
showGroupPlanModal()
}