From 06b48d4276020c00c191374cfe9696e6d4c4ef90 Mon Sep 17 00:00:00 2001 From: "codegen-sh[bot]" <131295404+codegen-sh[bot]@users.noreply.github.com> Date: Sun, 29 Jun 2025 10:43:38 +0000 Subject: [PATCH] Fix React 18 TypeScript compatibility issues - Fix function-based icons to direct JSX for React 18 compatibility - Update ActionContext parameter types in teams.tsx - Replace () => null with null for icon properties - Remove unused RootStore import --- app/actions/definitions/settings.tsx | 4 +-- app/actions/definitions/teams.tsx | 29 +++++++++---------- .../editor/lib/filterExcessSeparators.test.ts | 2 +- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/app/actions/definitions/settings.tsx b/app/actions/definitions/settings.tsx index 6db3c67ccc..e7f841ca83 100644 --- a/app/actions/definitions/settings.tsx +++ b/app/actions/definitions/settings.tsx @@ -42,9 +42,7 @@ export const changeTheme = createAction({ isContextMenu ? t("Appearance") : t("Change theme"), analyticsName: "Change theme", placeholder: ({ t }) => t("Change theme to"), - icon: function _Icon() { - return stores.ui.resolvedTheme === "light" ? : ; - }, + icon: stores.ui.resolvedTheme === "light" ? : , keywords: "appearance display", section: SettingsSection, children: [changeToLightTheme, changeToDarkTheme, changeToSystemTheme], diff --git a/app/actions/definitions/teams.tsx b/app/actions/definitions/teams.tsx index eb4cf85634..3d5ec790aa 100644 --- a/app/actions/definitions/teams.tsx +++ b/app/actions/definitions/teams.tsx @@ -1,7 +1,6 @@ import { ArrowIcon, PlusIcon } from "outline-icons"; import styled from "styled-components"; import { stringToColor } from "@shared/utils/color"; -import RootStore from "~/stores/RootStore"; import { LoginDialog } from "~/scenes/Login/components/LoginDialog"; import TeamNew from "~/scenes/TeamNew"; import TeamLogo from "~/components/TeamLogo"; @@ -10,27 +9,25 @@ import { ActionContext } from "~/types"; import Desktop from "~/utils/Desktop"; import { TeamSection } from "../sections"; -export const switchTeamsList = ({ stores }: { stores: RootStore }) => +export const switchTeamsList = ({ stores }: ActionContext) => stores.auth.availableTeams?.map((session) => ({ id: `switch-${session.id}`, name: session.name, analyticsName: "Switch workspace", section: TeamSection, keywords: "change switch workspace organization team", - icon: function _Icon() { - return ( - - ); - }, + icon: ( + + ), visible: ({ currentTeamId }: ActionContext) => currentTeamId !== session.id, perform: () => (window.location.href = session.url), })) ?? []; diff --git a/shared/editor/lib/filterExcessSeparators.test.ts b/shared/editor/lib/filterExcessSeparators.test.ts index 9f4e767e47..60b9144f26 100644 --- a/shared/editor/lib/filterExcessSeparators.test.ts +++ b/shared/editor/lib/filterExcessSeparators.test.ts @@ -3,7 +3,7 @@ import filterExcessSeparators from "./filterExcessSeparators"; const embedDescriptor = new EmbedDescriptor({ title: "Test", - icon: () => null, + icon: null, component: () => null, });