Skip to content

Commit 2e66997

Browse files
committed
perf: add dedupe strategy to composables
1 parent f93ef9d commit 2e66997

10 files changed

Lines changed: 28 additions & 10 deletions

File tree

app/composables/useAdmins.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ interface UseAdminsParams {
77

88
export const useAdmins = async (params?: UseAdminsParams) => {
99
return useAPI("/api/admins", {
10+
key: "admins",
11+
dedupe: "defer",
1012
lazy: params?.lazy ?? false,
11-
//cache: "force-cache",
1213
});
1314
};
1415

app/composables/useGuests.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ interface UseGuestsParams {
77

88
export const useGuests = async (params?: UseGuestsParams) => {
99
return useAPI("/api/guests", {
10+
key: "guests",
11+
dedupe: "defer",
1012
lazy: params?.lazy ?? false,
1113
});
1214
};

app/composables/useParticipants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ interface UseParticipantsParams {
88

99
export const useParticipants = async (params?: UseParticipantsParams) => {
1010
return useAPI<AdminParticipant[]>("/api/participants", {
11+
key: "participants",
12+
dedupe: "defer",
1113
lazy: params?.lazy ?? false,
12-
//cache: "force-cache",
1314
});
1415
};
1516

app/composables/useRoles.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ interface UseRolesParams {
77

88
export const useRoles = async (params?: UseRolesParams) => {
99
return useAPI("/api/roles", {
10+
key: "roles",
11+
dedupe: "defer",
1012
lazy: params?.lazy ?? false,
1113
});
1214
};
1315

1416
export const usePermissions = async () => {
15-
return useAPI("/api/permissions");
17+
return useAPI("/api/permissions", {
18+
key: "permissions",
19+
dedupe: "defer",
20+
});
1621
};
1722

1823
export const useRolesActions = () => {

app/composables/useRooms.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ interface UseRoomsParams {
77

88
export const useRooms = async (params?: UseRoomsParams) => {
99
return useAPI("/api/rooms", {
10+
key: "rooms",
11+
dedupe: "defer",
1012
lazy: params?.lazy ?? false,
11-
//cache: "force-cache",
1213
});
1314
};
1415

@@ -43,4 +44,4 @@ export const useRoomsActions = () => {
4344
};
4445

4546
return {createRoom, reorderRooms, renameRoom, removeRoom};
46-
};
47+
};

app/composables/useSchedule.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ interface UseScheduleParams {
77

88
export const useSchedule = async (params?: UseScheduleParams) => {
99
return useAPI("/api/schedule", {
10+
key: "schedule",
11+
dedupe: "defer",
1012
lazy: params?.lazy ?? false,
11-
//cache: "force-cache",
1213
});
1314
};
1415

app/composables/useSettings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ interface UseSettingsParams {
77
export const useSettings = async (params?: UseSettingsParams) => {
88
return useAPI("/api/settings", {
99
key: "settings",
10+
dedupe: "defer",
1011
lazy: params?.lazy ?? false,
1112
});
1213
};
1314

1415
export const useAdminSettings = async (params?: UseSettingsParams) => {
1516
return useAPI("/api/admin/settings", {
1617
key: "admin-settings",
18+
dedupe: "defer",
1719
lazy: params?.lazy ?? false,
1820
});
1921
};

app/composables/useSponsors.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ interface UseSponsorsParams {
77

88
export const useSponsors = async (params?: UseSponsorsParams) => {
99
return useAPI("/api/sponsors", {
10+
key: "sponsors",
11+
dedupe: "defer",
1012
lazy: params?.lazy ?? false,
1113
});
1214
};

app/composables/useSubmissions.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ interface UseSubmissionsParams {
99

1010
export const useSubmissionsRequests = async (params?: UseSubmissionsParams) => {
1111
return useAPI("/api/submissions/requests", {
12+
key: "submissions-requests",
13+
dedupe: "defer",
1214
lazy: params?.lazy ?? false,
13-
//cache: "force-cache",
1415
});
1516
};
1617

@@ -46,8 +47,9 @@ export const useSubmissionsRequestsActions = () => {
4647

4748
export const useSubmissions = async (params?: UseSubmissionsParams) => {
4849
return useAPI("/api/submissions/me", {
50+
key: "submissions",
51+
dedupe: "defer",
4952
lazy: params?.lazy ?? false,
50-
//cache: "force-cache",
5153
});
5254
};
5355

@@ -87,4 +89,4 @@ export const useSubmissionsActions = () => {
8789
uploadFiles,
8890
deleteSubmissionFile,
8991
};
90-
};
92+
};

app/composables/useTeams.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ interface UseTeamsParams {
88

99
export const useTeams = async (params?: UseTeamsParams) => {
1010
return useAPI<AdminTeam[]>("/api/teams", {
11+
key: "teams",
12+
dedupe: "defer",
1113
lazy: params?.lazy ?? false,
12-
//cache: "force-cache",
1314
});
1415
};
1516

0 commit comments

Comments
 (0)