From f6b7b84e883603516d572a3ab830f5557edee36e Mon Sep 17 00:00:00 2001 From: David <33458145+davidmcpowell@users.noreply.github.com> Date: Mon, 8 Jan 2024 10:38:47 +0000 Subject: [PATCH] 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 --- .../features/plans/group-plan-modal/index.js | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/services/web/frontend/js/features/plans/group-plan-modal/index.js b/services/web/frontend/js/features/plans/group-plan-modal/index.js index 60e2d81dbc..05f55742d5 100644 --- a/services/web/frontend/js/features/plans/group-plan-modal/index.js +++ b/services/web/frontend/js/features/plans/group-plan-modal/index.js @@ -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() }