Skip to content

Commit 3eaa712

Browse files
refactor(dashboard): remove unused Apollo queries and mutation functions (#8839)
* refactor: remove unused Apollo queries and mutation functions from Dashboard * fix: use hasEditorAccess instead of hasWriteAccess for deleted page context menu
1 parent 57d74c3 commit 3eaa712

File tree

6 files changed

+5
-526
lines changed

6 files changed

+5
-526
lines changed

packages/app/src/app/graphql/types.ts

Lines changed: 0 additions & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -5580,32 +5580,6 @@ export type SidebarCollectionFragment = {
55805580
path: string;
55815581
};
55825582

5583-
export type SandboxFragment = {
5584-
__typename?: 'Sandbox';
5585-
id: string;
5586-
alias: string | null;
5587-
title: string | null;
5588-
description: string | null;
5589-
insertedAt: string;
5590-
updatedAt: string;
5591-
removedAt: string | null;
5592-
privacy: number;
5593-
screenshotUrl: string | null;
5594-
teamId: any | null;
5595-
source: { __typename?: 'Source'; template: string | null };
5596-
customTemplate: { __typename?: 'Template'; id: any | null } | null;
5597-
forkedTemplate: {
5598-
__typename?: 'Template';
5599-
id: any | null;
5600-
color: string | null;
5601-
} | null;
5602-
collection: {
5603-
__typename?: 'Collection';
5604-
path: string;
5605-
teamId: any | null;
5606-
} | null;
5607-
};
5608-
56095583
export type TeamFragment = {
56105584
__typename?: 'Team';
56115585
id: any;
@@ -5736,156 +5710,6 @@ export type RenameSandboxMutation = {
57365710
renameSandbox: { __typename?: 'Sandbox'; id: string };
57375711
};
57385712

5739-
export type PermanentlyDeleteSandboxesMutationVariables = Exact<{
5740-
sandboxIds: Array<Scalars['ID']> | Scalars['ID'];
5741-
}>;
5742-
5743-
export type PermanentlyDeleteSandboxesMutation = {
5744-
__typename?: 'RootMutationType';
5745-
permanentlyDeleteSandboxes: Array<{ __typename?: 'Sandbox'; id: string }>;
5746-
};
5747-
5748-
export type PathedSandboxesQueryVariables = Exact<{
5749-
path: Scalars['String'];
5750-
teamId: InputMaybe<Scalars['ID']>;
5751-
}>;
5752-
5753-
export type PathedSandboxesQuery = {
5754-
__typename?: 'RootQueryType';
5755-
me: {
5756-
__typename?: 'CurrentUser';
5757-
id: any;
5758-
collections: Array<{
5759-
__typename?: 'Collection';
5760-
id: any | null;
5761-
path: string;
5762-
}>;
5763-
collection: {
5764-
__typename?: 'Collection';
5765-
id: any | null;
5766-
path: string;
5767-
sandboxes: Array<{
5768-
__typename?: 'Sandbox';
5769-
id: string;
5770-
alias: string | null;
5771-
title: string | null;
5772-
description: string | null;
5773-
insertedAt: string;
5774-
updatedAt: string;
5775-
removedAt: string | null;
5776-
privacy: number;
5777-
screenshotUrl: string | null;
5778-
teamId: any | null;
5779-
source: { __typename?: 'Source'; template: string | null };
5780-
customTemplate: { __typename?: 'Template'; id: any | null } | null;
5781-
forkedTemplate: {
5782-
__typename?: 'Template';
5783-
id: any | null;
5784-
color: string | null;
5785-
} | null;
5786-
collection: {
5787-
__typename?: 'Collection';
5788-
path: string;
5789-
teamId: any | null;
5790-
} | null;
5791-
}>;
5792-
} | null;
5793-
} | null;
5794-
};
5795-
5796-
export type RecentSandboxFragment = {
5797-
__typename?: 'Sandbox';
5798-
id: string;
5799-
alias: string | null;
5800-
title: string | null;
5801-
lastAccessedAt: any;
5802-
screenshotUrl: string | null;
5803-
privacy: number;
5804-
teamId: any | null;
5805-
source: { __typename?: 'Source'; template: string | null };
5806-
customTemplate: { __typename?: 'Template'; id: any | null } | null;
5807-
forkedTemplate: {
5808-
__typename?: 'Template';
5809-
id: any | null;
5810-
color: string | null;
5811-
} | null;
5812-
collection: {
5813-
__typename?: 'Collection';
5814-
path: string;
5815-
teamId: any | null;
5816-
} | null;
5817-
};
5818-
5819-
export type RecentSandboxesQueryVariables = Exact<{
5820-
orderField: Scalars['String'];
5821-
orderDirection: Direction;
5822-
}>;
5823-
5824-
export type RecentSandboxesQuery = {
5825-
__typename?: 'RootQueryType';
5826-
me: {
5827-
__typename?: 'CurrentUser';
5828-
id: any;
5829-
sandboxes: Array<{
5830-
__typename?: 'Sandbox';
5831-
id: string;
5832-
alias: string | null;
5833-
title: string | null;
5834-
lastAccessedAt: any;
5835-
screenshotUrl: string | null;
5836-
privacy: number;
5837-
teamId: any | null;
5838-
source: { __typename?: 'Source'; template: string | null };
5839-
customTemplate: { __typename?: 'Template'; id: any | null } | null;
5840-
forkedTemplate: {
5841-
__typename?: 'Template';
5842-
id: any | null;
5843-
color: string | null;
5844-
} | null;
5845-
collection: {
5846-
__typename?: 'Collection';
5847-
path: string;
5848-
teamId: any | null;
5849-
} | null;
5850-
}>;
5851-
} | null;
5852-
};
5853-
5854-
export type DeletedSandboxesQueryVariables = Exact<{ [key: string]: never }>;
5855-
5856-
export type DeletedSandboxesQuery = {
5857-
__typename?: 'RootQueryType';
5858-
me: {
5859-
__typename?: 'CurrentUser';
5860-
id: any;
5861-
sandboxes: Array<{
5862-
__typename?: 'Sandbox';
5863-
id: string;
5864-
alias: string | null;
5865-
title: string | null;
5866-
description: string | null;
5867-
insertedAt: string;
5868-
updatedAt: string;
5869-
removedAt: string | null;
5870-
privacy: number;
5871-
screenshotUrl: string | null;
5872-
teamId: any | null;
5873-
source: { __typename?: 'Source'; template: string | null };
5874-
customTemplate: { __typename?: 'Template'; id: any | null } | null;
5875-
forkedTemplate: {
5876-
__typename?: 'Template';
5877-
id: any | null;
5878-
color: string | null;
5879-
} | null;
5880-
collection: {
5881-
__typename?: 'Collection';
5882-
path: string;
5883-
teamId: any | null;
5884-
} | null;
5885-
}>;
5886-
} | null;
5887-
};
5888-
58895713
export type TeamQueryVariables = Exact<{
58905714
id: Scalars['UUID4'];
58915715
}>;

packages/app/src/app/pages/Dashboard/Components/Selection/ContextMenus/SandboxMenu.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ export const SandboxMenu: React.FC<SandboxMenuProps> = ({
5454

5555
const hasWriteAccess = isInActiveTeam && hasEditorAccess;
5656

57-
if (location.pathname.includes('deleted') && hasWriteAccess) {
57+
// For deleted page, we can trust that sandboxes belong to the active team
58+
// since they're already filtered by team in the query, so we only need hasEditorAccess
59+
if (location.pathname.includes('deleted') && hasEditorAccess) {
5860
return (
5961
<Menu.ContextMenu
6062
visible={visible}

0 commit comments

Comments
 (0)