File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
organization-[organization]/change-plan Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 30
30
} from ' @appwrite.io/pink-svelte' ;
31
31
import { writable } from ' svelte/store' ;
32
32
import { onMount } from ' svelte' ;
33
+ import { loadAvailableRegions } from ' $routes/(console)/regions' ;
33
34
import EstimatedTotalBox from ' $lib/components/billing/estimatedTotalBox.svelte' ;
34
35
35
36
export let data;
58
59
afterNavigate (({ from }) => {
59
60
previousPage = from ?.url ?.pathname || previousPage ;
60
61
});
62
+
61
63
onMount (async () => {
62
64
if (page .url .searchParams .has (' code' )) {
63
65
const coupon = page .url .searchParams .get (' code' );
218
220
}
219
221
220
222
if (isOrganization (org )) {
223
+ /**
224
+ * Reload on upgrade (e.g. Free → Paid)
225
+ */
226
+ loadAvailableRegions (org .$id , true );
227
+
221
228
await invalidate (Dependencies .ACCOUNT );
222
229
await invalidate (Dependencies .ORGANIZATION );
223
230
Original file line number Diff line number Diff line change @@ -10,13 +10,13 @@ let lastLoadedOrganization = null;
10
10
*
11
11
* Prevents unnecessary API calls if the regions are already loaded for the same organization.
12
12
*/
13
- export async function loadAvailableRegions ( orgId : string ) : Promise < void > {
13
+ export async function loadAvailableRegions ( orgId : string , force : boolean = false ) : Promise < void > {
14
14
if ( ! isCloud || ! orgId ) return ;
15
15
16
16
try {
17
17
const storedRegions = get ( regions ) ;
18
18
19
- if ( storedRegions . regions && lastLoadedOrganization === orgId ) {
19
+ if ( storedRegions . regions && lastLoadedOrganization === orgId && ! force ) {
20
20
// already loaded for this organization, fast path return.
21
21
return ;
22
22
}
You can’t perform that action at this time.
0 commit comments