perf: Cache translations per language/per release (#10843)

Co-authored-by: zomars <[email protected]>
This commit is contained in:
Keith Williamsandzomars authored and GitHub committed 2023-08-18 17:46:17 -07:00
1 parent e8554ed5c5
commit 3f273235a6
18 files changed
+75 -80

No files matched your search

@@ -11,7 +11,7 @@ const teamIdschema = z.object({
});
const auditAndReturnNextUser = async (
impersonatedUser: Pick<User, "id" | "username" | "email" | "name" | "role" | "organizationId">,
impersonatedUser: Pick<User, "id" | "username" | "email" | "name" | "role" | "organizationId" | "locale">,
impersonatedByUID: number,
hasTeam?: boolean
) => {
@@ -40,6 +40,7 @@ const auditAndReturnNextUser = async (
impersonatedByUID,
belongsToActiveTeam: hasTeam,
organizationId: impersonatedUser.organizationId,
locale: impersonatedUser.locale,
};
return obj;
@@ -97,6 +98,7 @@ const ImpersonationProvider = CredentialsProvider({
email: true,
organizationId: true,
disableImpersonation: true,
locale: true,
teams: {
where: {
disableImpersonation: false, // Ensure they have impersonation enabled
@@ -23,9 +23,6 @@ const DisableTeamImpersonation = ({
showToast(t("your_user_profile_updated_successfully"), "success");
await utils.viewer.teams.getMembershipbyUser.invalidate();
},
async onSettled() {
await utils.viewer.public.i18n.invalidate();
},
});
if (query.isLoading) return <></>;