Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Fix frontend type errors

carlosmonastyrski7f7677912446
diff --git a/backend/src/db/migrations/20250305131152_add-actor-id-to-secret-versions-v2.ts b/backend/src/db/migrations/20250305131152_add-actor-id-to-secret-versions-v2.ts
index e4340a436b..25237122bf 100644
--- a/backend/src/db/migrations/20250305131152_add-actor-id-to-secret-versions-v2.ts
+++ b/backend/src/db/migrations/20250305131152_add-actor-id-to-secret-versions-v2.ts
@@ -38,13 +38,13 @@ export async function down(knex: Knex): Promise<void> {
});
}
- if (!hasSecretVersionV2IdentityActorId) {
+ if (hasSecretVersionV2IdentityActorId) {
await knex.schema.alterTable(TableName.SecretVersionV2, (t) => {
t.dropColumn("identityActorId");
});
}
- if (!hasSecretVersionV2ActorType) {
+ if (hasSecretVersionV2ActorType) {
await knex.schema.alterTable(TableName.SecretVersionV2, (t) => {
t.dropColumn("actorType");
});
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx
index 2f1a178b96..1f89073857 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx
@@ -214,7 +214,7 @@ export const SecretDetailSidebar = ({
const secretReminderRepeatDays = watch("reminderRepeatDays");
const secretReminderNote = watch("reminderNote");
- const getModifiedByIcon = (userType: string) => {
+ const getModifiedByIcon = (userType: string | undefined | null) => {
switch (userType) {
case ActorType.USER:
return faUser;
@@ -225,7 +225,7 @@ export const SecretDetailSidebar = ({
}
};
- const getModifiedByName = (userType: string, userName: string | undefined) => {
+ const getModifiedByName = (userType: string | undefined | null, userName: string | null | undefined) => {
switch (userType) {
case ActorType.PLATFORM:
return "System-generated";
@@ -235,7 +235,8 @@ export const SecretDetailSidebar = ({
};
const getUserMembershipId = (actorId: string) => {
- return members.filter((member) => member.user?.id === actorId)?.[0].id || null;
+ const foundMember = members.find((member) => member.user?.id === actorId);
+ return foundMember?.id || null;
};
const getLinkToModifyHistoryEntity = (actorId: string, actorType: string) => {
@@ -249,8 +250,8 @@ export const SecretDetailSidebar = ({
}
};
- const onModifyHistoryClick = (actorId: string | undefined, actorType: string) => {
- if (actorId && actorType !== ActorType.PLATFORM) {
+ const onModifyHistoryClick = (actorId: string | undefined | null, actorType: string | undefined | null) => {
+ if (actorType && actorId && actorType !== ActorType.PLATFORM) {
const redirectLink = getLinkToModifyHistoryEntity(actorId, actorType);
if (redirectLink) {
navigate({ to: redirectLink });