Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { FEATURE_FLAGS } from "@superset/shared/constants";
import { Button } from "@superset/ui/button";
import { Skeleton } from "@superset/ui/skeleton";
import { useLiveQuery } from "@tanstack/react-db";
import { useFeatureFlagEnabled } from "posthog-js/react";
import { useCallback, useEffect, useState } from "react";
import { FaGithub, FaSlack } from "react-icons/fa";
import { HiOutlineArrowTopRightOnSquare } from "react-icons/hi2";
Expand Down Expand Up @@ -51,10 +49,6 @@ export function IntegrationsSettings({
useState<GithubInstallation | null>(null);
const [isLoadingGithub, setIsLoadingGithub] = useState(true);

const hasSlackAccess = useFeatureFlagEnabled(
FEATURE_FLAGS.SLACK_INTEGRATION_ACCESS,
);

const showLinear = isItemVisible(
SETTING_ITEM_ID.INTEGRATIONS_LINEAR,
visibleItems,
Expand Down Expand Up @@ -93,9 +87,10 @@ export function IntegrationsSettings({
const isSlackConnected = !!slackConnection;
const isGithubConnected =
!!githubInstallation && !githubInstallation.suspended;
const showSlack =
hasSlackAccess &&
isItemVisible(SETTING_ITEM_ID.INTEGRATIONS_SLACK, visibleItems);
const showSlack = isItemVisible(
SETTING_ITEM_ID.INTEGRATIONS_SLACK,
visibleItems,
);

const handleOpenWeb = (path: string) => {
window.open(`${env.NEXT_PUBLIC_WEB_URL}${path}`, "_blank");
Expand Down
18 changes: 1 addition & 17 deletions apps/web/src/app/(dashboard-legacy)/integrations/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
"use client";

import { FEATURE_FLAGS } from "@superset/shared/constants";
import { useFeatureFlagEnabled } from "posthog-js/react";
import { useMemo } from "react";
import { FaGithub, FaSlack } from "react-icons/fa";
Comment on lines 1 to 3

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 After removing useFeatureFlagEnabled and useMemo, this component uses no React hooks and no browser-only APIs. The "use client" directive now forces the entire page (including the static integrations constant with JSX icon nodes) to be included in the client bundle unnecessarily. Dropping it lets Next.js render the page on the server, reducing JS sent to the browser. IntegrationCard already carries its own "use client" boundary, so mouse-hover interactivity is unaffected.

Suggested change
"use client";
import { FEATURE_FLAGS } from "@superset/shared/constants";
import { useFeatureFlagEnabled } from "posthog-js/react";
import { useMemo } from "react";
import { FaGithub, FaSlack } from "react-icons/fa";
import { FaGithub, FaSlack } from "react-icons/fa";
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/web/src/app/(dashboard-legacy)/integrations/page.tsx
Line: 1-3

Comment:
After removing `useFeatureFlagEnabled` and `useMemo`, this component uses no React hooks and no browser-only APIs. The `"use client"` directive now forces the entire page (including the static `integrations` constant with JSX icon nodes) to be included in the client bundle unnecessarily. Dropping it lets Next.js render the page on the server, reducing JS sent to the browser. `IntegrationCard` already carries its own `"use client"` boundary, so mouse-hover interactivity is unaffected.

```suggestion
import { FaGithub, FaSlack } from "react-icons/fa";
```

How can I resolve this? If you propose a fix, please make it concise.

import { SiLinear } from "react-icons/si";
import {
Expand Down Expand Up @@ -38,19 +35,6 @@ const integrations: IntegrationCardProps[] = [
];

export default function IntegrationsPage() {
const hasSlackAccess = useFeatureFlagEnabled(
FEATURE_FLAGS.SLACK_INTEGRATION_ACCESS,
);

const visibleIntegrations = useMemo(
() =>
integrations.filter((i) => {
if (i.id === "slack") return hasSlackAccess;
return true;
}),
[hasSlackAccess],
);

return (
<div className="space-y-8">
<section>
Expand All @@ -60,7 +44,7 @@ export default function IntegrationsPage() {
</p>

<div className="mt-6 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
{visibleIntegrations.map((integration) => (
{integrations.map((integration) => (
<IntegrationCard key={integration.id} {...integration} />
))}
</div>
Expand Down
38 changes: 0 additions & 38 deletions apps/web/src/app/(dashboard-legacy)/integrations/slack/layout.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions packages/shared/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ export const FEATURE_FLAGS = {
WEB_AGENTS_UI_ACCESS: "web-agents-ui-access",
/** Gates access to GitHub integration (currently buggy, internal only). */
GITHUB_INTEGRATION_ACCESS: "github-integration-access",
/** Gates access to Slack integration (internal only). */
SLACK_INTEGRATION_ACCESS: "slack-integration-access",
/** Gates access to Cloud features (environment variables, sandboxes). */
CLOUD_ACCESS: "cloud-access",
/** When enabled, blocks remote agent execution on the desktop (e.g., for enterprise orgs). */
Expand Down
Loading