From e82a2931cc8ed3b4b4efe82e26257607ee76516a Mon Sep 17 00:00:00 2001 From: andrewwallacespeckle Date: Thu, 10 Jul 2025 14:58:27 +0100 Subject: [PATCH] Remove unnecessary watch --- .../lib/common/generated/gql/graphql.ts | 70 ++++++++++++++++--- .../src/components/layout/tabs/Horizontal.vue | 14 +--- 2 files changed, 63 insertions(+), 21 deletions(-) diff --git a/packages/frontend-2/lib/common/generated/gql/graphql.ts b/packages/frontend-2/lib/common/generated/gql/graphql.ts index 123826ecc..188f58cad 100644 --- a/packages/frontend-2/lib/common/generated/gql/graphql.ts +++ b/packages/frontend-2/lib/common/generated/gql/graphql.ts @@ -922,6 +922,12 @@ export type CreateCommentReplyInput = { threadId: Scalars['String']['input']; }; +export type CreateEmbedTokenReturn = { + __typename?: 'CreateEmbedTokenReturn'; + token: Scalars['String']['output']; + tokenMetadata: EmbedToken; +}; + export type CreateModelInput = { description?: InputMaybe; name: Scalars['String']['input']; @@ -1000,20 +1006,30 @@ export type EmailVerificationRequestInput = { id: Scalars['ID']['input']; }; +/** A token used to enable an embedded viewer for a private project */ export type EmbedToken = { __typename?: 'EmbedToken'; createdAt: Scalars['DateTime']['output']; - id: Scalars['String']['output']; lastUsed: Scalars['DateTime']['output']; lifespan: Scalars['BigInt']['output']; - modelIds: Scalars['String']['output']; - name: Scalars['String']['output']; + projectId: Scalars['String']['output']; + resourceIdString: Scalars['String']['output']; + tokenId: Scalars['String']['output']; + user?: Maybe; +}; + +export type EmbedTokenCollection = { + __typename?: 'EmbedTokenCollection'; + cursor?: Maybe; + items: Array; + totalCount: Scalars['Int']['output']; }; export type EmbedTokenCreateInput = { lifespan?: InputMaybe; - modelIds: Scalars['String']['input']; projectId: Scalars['String']['input']; + /** The model(s) and version(s) string used in the embed url */ + resourceIdString: Scalars['String']['input']; }; export type FileUpload = { @@ -2111,7 +2127,7 @@ export type Project = { description?: Maybe; /** Public project-level configuration for embedded viewer */ embedOptions: ProjectEmbedOptions; - embedTokens: Array; + embedTokens: EmbedTokenCollection; hasAccessToFeature: Scalars['Boolean']['output']; id: Scalars['ID']['output']; invitableCollaborators: WorkspaceCollaboratorCollection; @@ -2194,6 +2210,12 @@ export type ProjectCommentThreadsArgs = { }; +export type ProjectEmbedTokensArgs = { + cursor?: InputMaybe; + limit?: InputMaybe; +}; + + export type ProjectHasAccessToFeatureArgs = { featureName: WorkspaceFeatureName; }; @@ -2593,7 +2615,7 @@ export type ProjectMutations = { batchDelete: Scalars['Boolean']['output']; /** Create new project */ create: Project; - createEmbedToken: Scalars['String']['output']; + createEmbedToken: CreateEmbedTokenReturn; /** * Create onboarding/tutorial project. If one is already created for the active user, that * one will be returned instead. @@ -2606,6 +2628,7 @@ export type ProjectMutations = { /** Leave a project. Only possible if you're not the last remaining owner. */ leave: Scalars['Boolean']['output']; revokeEmbedToken: Scalars['Boolean']['output']; + revokeEmbedTokens: Scalars['Boolean']['output']; /** Updates an existing project */ update: Project; /** Update role for a collaborator */ @@ -2644,10 +2667,16 @@ export type ProjectMutationsLeaveArgs = { export type ProjectMutationsRevokeEmbedTokenArgs = { + projectId: Scalars['String']['input']; token: Scalars['String']['input']; }; +export type ProjectMutationsRevokeEmbedTokensArgs = { + projectId: Scalars['String']['input']; +}; + + export type ProjectMutationsUpdateArgs = { update: ProjectUpdateInput; }; @@ -2690,6 +2719,7 @@ export type ProjectPermissionChecks = { canBroadcastActivity: PermissionCheckResult; canCreateAutomation: PermissionCheckResult; canCreateComment: PermissionCheckResult; + canCreateEmbedTokens: PermissionCheckResult; canCreateModel: PermissionCheckResult; canDelete: PermissionCheckResult; canInvite: PermissionCheckResult; @@ -2698,9 +2728,11 @@ export type ProjectPermissionChecks = { canMoveToWorkspace: PermissionCheckResult; canPublish: PermissionCheckResult; canRead: PermissionCheckResult; + canReadEmbedTokens: PermissionCheckResult; canReadSettings: PermissionCheckResult; canReadWebhooks: PermissionCheckResult; canRequestRender: PermissionCheckResult; + canRevokeEmbedTokens: PermissionCheckResult; canUpdate: PermissionCheckResult; canUpdateAllowPublicComments: PermissionCheckResult; }; @@ -7929,8 +7961,10 @@ export type AllObjectTypes = { Commit: Commit, CommitCollection: CommitCollection, CountOnlyCollection: CountOnlyCollection, + CreateEmbedTokenReturn: CreateEmbedTokenReturn, CurrencyBasedPrices: CurrencyBasedPrices, EmbedToken: EmbedToken, + EmbedTokenCollection: EmbedTokenCollection, FileUpload: FileUpload, FileUploadCollection: FileUploadCollection, FileUploadMutations: FileUploadMutations, @@ -8389,17 +8423,27 @@ export type CommitCollectionFieldArgs = { export type CountOnlyCollectionFieldArgs = { totalCount: {}, } +export type CreateEmbedTokenReturnFieldArgs = { + token: {}, + tokenMetadata: {}, +} export type CurrencyBasedPricesFieldArgs = { gbp: {}, usd: {}, } export type EmbedTokenFieldArgs = { createdAt: {}, - id: {}, lastUsed: {}, lifespan: {}, - modelIds: {}, - name: {}, + projectId: {}, + resourceIdString: {}, + tokenId: {}, + user: {}, +} +export type EmbedTokenCollectionFieldArgs = { + cursor: {}, + items: {}, + totalCount: {}, } export type FileUploadFieldArgs = { branchName: {}, @@ -8694,7 +8738,7 @@ export type ProjectFieldArgs = { createdAt: {}, description: {}, embedOptions: {}, - embedTokens: {}, + embedTokens: ProjectEmbedTokensArgs, hasAccessToFeature: ProjectHasAccessToFeatureArgs, id: {}, invitableCollaborators: ProjectInvitableCollaboratorsArgs, @@ -8807,6 +8851,7 @@ export type ProjectMutationsFieldArgs = { invites: {}, leave: ProjectMutationsLeaveArgs, revokeEmbedToken: ProjectMutationsRevokeEmbedTokenArgs, + revokeEmbedTokens: ProjectMutationsRevokeEmbedTokensArgs, update: ProjectMutationsUpdateArgs, updateRole: ProjectMutationsUpdateRoleArgs, } @@ -8824,6 +8869,7 @@ export type ProjectPermissionChecksFieldArgs = { canBroadcastActivity: {}, canCreateAutomation: {}, canCreateComment: {}, + canCreateEmbedTokens: {}, canCreateModel: {}, canDelete: {}, canInvite: {}, @@ -8832,9 +8878,11 @@ export type ProjectPermissionChecksFieldArgs = { canMoveToWorkspace: ProjectPermissionChecksCanMoveToWorkspaceArgs, canPublish: {}, canRead: {}, + canReadEmbedTokens: {}, canReadSettings: {}, canReadWebhooks: {}, canRequestRender: {}, + canRevokeEmbedTokens: {}, canUpdate: {}, canUpdateAllowPublicComments: {}, } @@ -9569,8 +9617,10 @@ export type AllObjectFieldArgTypes = { Commit: CommitFieldArgs, CommitCollection: CommitCollectionFieldArgs, CountOnlyCollection: CountOnlyCollectionFieldArgs, + CreateEmbedTokenReturn: CreateEmbedTokenReturnFieldArgs, CurrencyBasedPrices: CurrencyBasedPricesFieldArgs, EmbedToken: EmbedTokenFieldArgs, + EmbedTokenCollection: EmbedTokenCollectionFieldArgs, FileUpload: FileUploadFieldArgs, FileUploadCollection: FileUploadCollectionFieldArgs, FileUploadMutations: FileUploadMutationsFieldArgs, diff --git a/packages/ui-components/src/components/layout/tabs/Horizontal.vue b/packages/ui-components/src/components/layout/tabs/Horizontal.vue index 486edd731..e68ec2db5 100644 --- a/packages/ui-components/src/components/layout/tabs/Horizontal.vue +++ b/packages/ui-components/src/components/layout/tabs/Horizontal.vue @@ -233,21 +233,13 @@ watch( } ) -// React to size changes of the active tab (e.g. when count badge disappears) -watch( - () => activeItemRef.value, - (el, _prev, onCleanup) => { - if (!el) return - updateUnderline() - - const { stop } = useResizeObserver(el, updateUnderline) - onCleanup(stop) - }, - { immediate: true } +const { stop: stopResizeObserver } = useResizeObserver(activeItemRef, () => + updateUnderline() ) onBeforeUnmount(() => { handleScroll.cancel() + stopResizeObserver() })