fix(dashboard): refresh the Usage tab when the subscription changes

An upgrade from the Usage tab's own button, or a return from the billing
portal, refreshed Home behind it while the Usage meter and plan button
kept the old allowance until the user left the tab and came back. Usage
now handles puter:subscription:changed while it is showing.
This commit is contained in:
Nariman Jelveh committed 2026-10-23 14:21:47 -07:00
1 parent bb74a2e8de
commit dc9ce4fffd
1 file changed
+9
+9
View File
@@ -97,6 +97,15 @@ const TabUsage = {
refreshUsageDetails($el_window);
// An upgrade, a plan change, or a return from the billing portal (see
// TabHome) changes the allowance and the button shown here. Hidden,
// the tab refreshes on its next activation instead.
window.addEventListener('puter:subscription:changed', () => {
if ( ! $($el_window).find('.dashboard-section-usage').hasClass('active') ) return;
setupPlanButton($el_window);
refreshUsageDetails($el_window);
});
// Click handler for sortable table headers
$($el_window).on('click', '.driver-usage-details-content-table th[data-sort]', function () {
const column = $(this).data('sort');