diff --git a/packages/core/src/operator.ts b/packages/core/src/operator.ts index ce72bc973e..7386e8045f 100644 --- a/packages/core/src/operator.ts +++ b/packages/core/src/operator.ts @@ -14,6 +14,7 @@ // limitations under the License. // +import { Analytics } from '@hcengineering/analytics' import type { Doc, PropertyType } from './classes' import type { Position, PullArray, QueryUpdate } from './tx' @@ -43,7 +44,12 @@ function $push (document: Doc, keyval: Record): void { if (doc[key] === null || doc[key] === undefined) { doc[key] = [kvk] } else { - doc[key].push(kvk) + if (Array.isArray(doc[key])) { + doc[key].push(kvk) + } else { + Analytics.handleError(new Error(`invalid array value: ${JSON.stringify(doc[key])} `)) + doc[key] = [kvk] + } } } } diff --git a/packages/presentation/src/pipeline.ts b/packages/presentation/src/pipeline.ts index 4dc23a0470..b1c17c9069 100644 --- a/packages/presentation/src/pipeline.ts +++ b/packages/presentation/src/pipeline.ts @@ -1,4 +1,3 @@ -import { Analytics } from '@hcengineering/analytics' import { toFindResult, type Class, @@ -118,7 +117,6 @@ export class PresentationPipelineImpl implements PresentationPipeline { return toFindResult([], -1) } } - Analytics.handleError(err as Error) const status = unknownError(err) await setPlatformStatus(status) return toFindResult([], -1) @@ -144,7 +142,6 @@ export class PresentationPipelineImpl implements PresentationPipeline { return } } - Analytics.handleError(err as Error) const status = unknownError(err) await setPlatformStatus(status) } @@ -178,7 +175,6 @@ export class PresentationPipelineImpl implements PresentationPipeline { return {} } } - Analytics.handleError(err as Error) const status = unknownError(err) await setPlatformStatus(status) return {} diff --git a/plugins/client-resources/src/connection.ts b/plugins/client-resources/src/connection.ts index 264627289b..e2d04df9d9 100644 --- a/plugins/client-resources/src/connection.ts +++ b/plugins/client-resources/src/connection.ts @@ -318,7 +318,12 @@ class Connection implements ClientConnection { if (resp.error !== undefined) { if (resp.error?.code === UNAUTHORIZED.code || resp.terminate === true) { - Analytics.handleError(new PlatformError(resp.error)) + if ( + resp.error.code !== platform.status.WorkspaceArchived || + resp.error.code !== platform.status.WorkspaceNotFound + ) { + Analytics.handleError(new PlatformError(resp.error)) + } this.closed = true this.websocket?.close() if (resp.error?.code === UNAUTHORIZED.code) { diff --git a/plugins/drive-resources/src/utils.ts b/plugins/drive-resources/src/utils.ts index fab8bc65d1..56c4879912 100644 --- a/plugins/drive-resources/src/utils.ts +++ b/plugins/drive-resources/src/utils.ts @@ -284,7 +284,6 @@ async function fileUploadCallback (space: Ref, parent: Ref): Prom Analytics.handleEvent(DriveEvents.FileUploaded, { ok: true, type: file.type, size: file.size, name }) } catch (err) { void setPlatformStatus(unknownError(err)) - Analytics.handleEvent(DriveEvents.FileUploaded, { ok: false, name }) } } diff --git a/plugins/gmail-resources/src/components/NewMessage.svelte b/plugins/gmail-resources/src/components/NewMessage.svelte index 3ca0d6d7f2..df9837e05d 100644 --- a/plugins/gmail-resources/src/components/NewMessage.svelte +++ b/plugins/gmail-resources/src/components/NewMessage.svelte @@ -135,7 +135,6 @@ } ) } catch (err: any) { - Analytics.handleError(err) setPlatformStatus(unknownError(err)) } } diff --git a/plugins/gmail-resources/src/components/NewMessages.svelte b/plugins/gmail-resources/src/components/NewMessages.svelte index 60440969e8..a39cad31e1 100644 --- a/plugins/gmail-resources/src/components/NewMessages.svelte +++ b/plugins/gmail-resources/src/components/NewMessages.svelte @@ -163,7 +163,6 @@ } ) } catch (err: any) { - Analytics.handleError(err) setPlatformStatus(unknownError(err)) } } diff --git a/plugins/recruit-resources/src/components/CreateCandidate.svelte b/plugins/recruit-resources/src/components/CreateCandidate.svelte index b49355c41a..88ba5169cf 100644 --- a/plugins/recruit-resources/src/components/CreateCandidate.svelte +++ b/plugins/recruit-resources/src/components/CreateCandidate.svelte @@ -483,7 +483,6 @@ await recognize(file) } catch (err: any) { - Analytics.handleError(err) setPlatformStatus(unknownError(err)) } finally { loading = false diff --git a/plugins/tags-resources/src/components/LabelsPresenter.svelte b/plugins/tags-resources/src/components/LabelsPresenter.svelte index dafe0c6185..e09f2aa8c8 100644 --- a/plugins/tags-resources/src/components/LabelsPresenter.svelte +++ b/plugins/tags-resources/src/components/LabelsPresenter.svelte @@ -61,7 +61,7 @@ else { allWidth = 0 for (let i = 0; i < items.length; i++) { - if (elements[i].clientWidth !== undefined && allWidth < elements[i].clientWidth) { + if (elements[i]?.clientWidth !== undefined && allWidth < elements[i]?.clientWidth) { allWidth = elements[i].clientWidth } }