mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-15 09:06:19 +08:00
feat(editor): improve edgeless perf & memory usage (#14591)
#### PR Dependency Tree * **PR #14591** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * New canvas renderer debug metrics and controls for runtime inspection. * Mindmap/group reordering now normalizes group targets, improving reorder consistency. * **Bug Fixes** * Fixed connector behavior for empty/degenerate paths. * More aggressive viewport invalidation so structural changes display correctly. * Improved z-index synchronization during transforms and layer updates. * **Performance** * Retained DOM caching for brushes, shapes, and connectors to reduce DOM churn. * Targeted canvas refreshes, pooling, and reuse to lower redraw and memory overhead. * **Tests** * Added canvas renderer performance benchmarks and curve edge-case unit tests. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { Logger } from '@nestjs/common';
|
||||
|
||||
import { CleanedTelemetryEvent, Scalar } from './cleaner';
|
||||
|
||||
const GA4_ENDPOINT = 'https://www.google-analytics.com/mp/collect';
|
||||
@@ -14,6 +16,7 @@ type Ga4Payload = {
|
||||
};
|
||||
|
||||
export class Ga4Client {
|
||||
private readonly logger = new Logger(Ga4Client.name);
|
||||
constructor(
|
||||
private readonly measurementId: string,
|
||||
private readonly apiSecret: string,
|
||||
@@ -45,10 +48,13 @@ export class Ga4Client {
|
||||
try {
|
||||
await this.post(payload);
|
||||
} catch {
|
||||
if (env.DEPLOYMENT_TYPE === 'affine') {
|
||||
if (
|
||||
env.DEPLOYMENT_TYPE === 'affine' &&
|
||||
env.NODE_ENV === 'production'
|
||||
) {
|
||||
// In production, we want to be resilient to GA4 failures, so we catch and ignore errors.
|
||||
// In non-production environments, we rethrow to surface issues during development and testing.
|
||||
console.info(
|
||||
this.logger.log(
|
||||
'Failed to send telemetry event to GA4:',
|
||||
chunk.map(e => e.eventName).join(', ')
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user