Skip to content

Commit 3312e37

Browse files
ArmanNikTorstenDittmann
authored andcommitted
fix: invalidation + limit not being updated on members deletion
1 parent 852261b commit 3312e37

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

src/lib/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export enum Dependencies {
88
ADDRESS = 'dependency:address',
99
PAYMENT_METHODS = 'dependency:paymentMethods',
1010
ORGANIZATION = 'dependency:organization',
11+
MEMBERS = 'dependency:members',
1112
PROJECT = 'dependency:project',
1213
PROJECT_VARIABLES = 'dependency:project_variables',
1314
PROJECT_INSTALLATIONS = 'dependency:project_installations',

src/routes/console/organization-[organization]/+layout.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { preferences } from '$lib/stores/preferences';
1313

1414
export const load: LayoutLoad = async ({ params, depends }) => {
1515
depends(Dependencies.ORGANIZATION);
16+
depends(Dependencies.MEMBERS);
1617
depends(Dependencies.PAYMENT_METHODS);
1718

1819
if (isCloud) {

src/routes/console/organization-[organization]/deleteMember.svelte

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
22
import { base } from '$app/paths';
3-
import { goto } from '$app/navigation';
3+
import { goto, invalidate } from '$app/navigation';
44
import { Modal } from '$lib/components';
55
import { Button } from '$lib/elements/forms';
66
import { addNotification } from '$lib/stores/notifications';
@@ -9,6 +9,10 @@
99
import { createEventDispatcher } from 'svelte';
1010
import { user } from '$lib/stores/user';
1111
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
12+
import { Dependencies } from '$lib/constants';
13+
import { checkForUsageLimit } from '$lib/stores/billing';
14+
import { isCloud } from '$lib/system';
15+
import { organization } from '$lib/stores/organization';
1216
1317
const dispatch = createEventDispatcher();
1418
@@ -25,6 +29,11 @@
2529
} else {
2630
dispatch('deleted');
2731
}
32+
invalidate(Dependencies.ACCOUNT);
33+
invalidate(Dependencies.MEMBERS);
34+
if (isCloud && $organization) {
35+
await checkForUsageLimit($organization);
36+
}
2837
showDelete = false;
2938
addNotification({
3039
type: 'success',

src/routes/console/organization-[organization]/members/+page.svelte

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<script lang="ts">
2-
import { invalidate } from '$app/navigation';
32
import { page } from '$app/stores';
43
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
54
import { AvatarInitials, PaginationWithLimit } from '$lib/components';
6-
import { Dependencies } from '$lib/constants';
75
import { Pill } from '$lib/elements';
86
import { Button } from '$lib/elements/forms';
97
import {
@@ -29,7 +27,6 @@
2927
let selectedMember: Models.Membership;
3028
let showDelete = false;
3129
const url = `${$page.url.origin}/console/`;
32-
const deleted = () => invalidate(Dependencies.ACCOUNT);
3330
const resend = async (member: Models.Membership) => {
3431
try {
3532
await sdk.forConsole.teams.createMembership(
@@ -124,4 +121,4 @@
124121
{/if}
125122
</Container>
126123

127-
<Delete {selectedMember} bind:showDelete on:deleted={() => deleted()} />
124+
<Delete {selectedMember} bind:showDelete />

src/routes/console/organization-[organization]/members/+page.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type { PageLoad } from './$types';
66

77
export const load: PageLoad = async ({ url, params, route, depends }) => {
88
depends(Dependencies.ORGANIZATION);
9+
depends(Dependencies.MEMBERS);
910
const page = getPage(url);
1011
const limit = getLimit(url, route, PAGE_LIMIT);
1112
const offset = pageToOffset(page, limit);

0 commit comments

Comments
 (0)