Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

PR review fixes #2

Blue Mouse637eade39c70
diff --git a/backend/apps/cloud/src/analytics/analytics.controller.ts b/backend/apps/cloud/src/analytics/analytics.controller.ts
index f5530b99d..8100419e9 100644
--- a/backend/apps/cloud/src/analytics/analytics.controller.ts
+++ b/backend/apps/cloud/src/analytics/analytics.controller.ts
@@ -69,7 +69,10 @@ import { clickhouse } from '../common/integrations/clickhouse'
import { checkRateLimit, getIPDetails, getIPFromHeaders } from '../common/utils'
import { GetCustomEventsDto } from './dto/get-custom-events.dto'
import { GetFiltersDto } from './dto/get-filters.dto'
-import { DataDeletionDto } from './dto/data-deletion.dto'
+import {
+ DataDeletionDto,
+ DataDeletionPreviewDto,
+} from './dto/data-deletion.dto'
import { GetVersionFiltersDto } from './dto/get-version-filters.dto'
import {
IFunnel,
@@ -2885,7 +2888,7 @@ export class AnalyticsController {
@HttpCode(200)
@Auth()
async getDataDeletionPreview(
- @Body() body: DataDeletionDto,
+ @Body() body: DataDeletionPreviewDto,
@CurrentUserId() uid: string,
) {
await this.analyticsService.checkManageAccess(body.pid, uid)
@@ -2917,7 +2920,7 @@ export class AnalyticsController {
body.filters || '[]',
body.from || null,
body.to || null,
- body.types || ['pageview', 'custom_event'],
+ body.types,
)
return { deleted: true }
diff --git a/backend/apps/cloud/src/analytics/dto/data-deletion.dto.ts b/backend/apps/cloud/src/analytics/dto/data-deletion.dto.ts
index ee48f8c8c..b1d806853 100644
--- a/backend/apps/cloud/src/analytics/dto/data-deletion.dto.ts
+++ b/backend/apps/cloud/src/analytics/dto/data-deletion.dto.ts
@@ -1,10 +1,11 @@
import { ApiProperty } from '@nestjs/swagger'
import {
+ ArrayNotEmpty,
IsIn,
IsNotEmpty,
+ IsArray,
IsOptional,
IsString,
- IsArray,
Matches,
} from 'class-validator'
import { PID_REGEX } from '../../common/constants'
@@ -19,7 +20,7 @@ export const DATA_DELETION_EVENT_TYPES = [
export type DataDeletionEventType = (typeof DATA_DELETION_EVENT_TYPES)[number]
-export class DataDeletionDto {
+export class DataDeletionPreviewDto {
@ApiProperty({
example: 'aUn1quEid-3',
required: true,
@@ -55,17 +56,19 @@ export class DataDeletionDto {
@IsOptional()
@IsString()
to?: string
+}
+export class DataDeletionDto extends DataDeletionPreviewDto {
@ApiProperty({
- required: false,
+ required: true,
type: [String],
enum: DATA_DELETION_EVENT_TYPES,
description:
"Event types to delete. Any of: 'pageview', 'custom_event', 'error', 'performance', 'captcha'.",
})
- @IsOptional()
@IsArray()
+ @ArrayNotEmpty()
@IsString({ each: true })
@IsIn(DATA_DELETION_EVENT_TYPES as unknown as string[], { each: true })
- types?: DataDeletionEventType[]
+ types: DataDeletionEventType[]
}
diff --git a/web/app/pages/Project/View/components/TabErrorBoundary.tsx b/web/app/pages/Project/View/components/TabErrorBoundary.tsx
index d95a913ee..ce8b971e4 100644
--- a/web/app/pages/Project/View/components/TabErrorBoundary.tsx
+++ b/web/app/pages/Project/View/components/TabErrorBoundary.tsx
@@ -35,8 +35,6 @@ interface TabErrorBoundaryProps {
interface TabErrorBoundaryState {
hasError: boolean
resetKey: unknown
- titleKey?: string
- children: ReactNode
}
/**
@@ -53,8 +51,6 @@ class TabErrorBoundary extends Component<
this.state = {
hasError: false,
resetKey: props.resetKey,
- titleKey: props.titleKey,
- children: props.children,
}
}
@@ -66,19 +62,13 @@ class TabErrorBoundary extends Component<
props: TabErrorBoundaryProps,
state: TabErrorBoundaryState,
): Partial<TabErrorBoundaryState> | null {
- if (
- props.resetKey === state.resetKey &&
- props.titleKey === state.titleKey &&
- props.children === state.children
- ) {
+ if (props.resetKey === state.resetKey) {
return null
}
return {
hasError: false,
resetKey: props.resetKey,
- titleKey: props.titleKey,
- children: props.children,
}
}