From fd9bf0120c02834ae003ede79517c4c74289bc33 Mon Sep 17 00:00:00 2001 From: Carlos Valente Date: Sun, 13 Jul 2025 08:12:02 +0200 Subject: [PATCH] refactor: disable react compiler --- .../panel/automations-panel/AutomationForm.tsx | 4 ++-- .../automations-panel/AutomationSettingsForm.tsx | 8 ++++++-- .../panel/automations-panel/OntimeActionForm.tsx | 13 ++++++++++--- .../panel/automations-panel/TriggerForm.tsx | 1 + .../panel/feature-panel/GenerateLinkForm.tsx | 3 +++ .../panel/feature-panel/UrlPresetsForm.tsx | 1 + .../manage-panel/composite/CustomFieldForm.tsx | 10 ++++++++-- .../sources-panel/import-map/ImportMapForm.tsx | 10 ++++++++-- .../panel/project-panel/ProjectCreateForm.tsx | 5 ++--- .../panel/project-panel/ProjectForm.tsx | 1 + .../panel/project-panel/ProjectMergeForm.tsx | 4 ++-- .../panel/settings-panel/GeneralSettings.tsx | 1 + .../panel/settings-panel/ProjectData.tsx | 1 + .../panel/settings-panel/ViewSettings.tsx | 1 + .../app-settings/quick-start/QuickStart.tsx | 1 + apps/client/vite.config.js | 9 +-------- 16 files changed, 49 insertions(+), 24 deletions(-) diff --git a/apps/client/src/features/app-settings/panel/automations-panel/AutomationForm.tsx b/apps/client/src/features/app-settings/panel/automations-panel/AutomationForm.tsx index 211b193a6..c79ded952 100644 --- a/apps/client/src/features/app-settings/panel/automations-panel/AutomationForm.tsx +++ b/apps/client/src/features/app-settings/panel/automations-panel/AutomationForm.tsx @@ -41,8 +41,8 @@ interface AutomationFormProps { onClose: () => void; } -export default function AutomationForm(props: AutomationFormProps) { - const { automation, onClose } = props; +export default function AutomationForm({ automation, onClose }: AutomationFormProps) { + 'no memo'; // RHF and react-compiler dont seem to get along const isEdit = isAutomation(automation); const { data } = useCustomFields(); const { refetch } = useAutomationSettings(); diff --git a/apps/client/src/features/app-settings/panel/automations-panel/AutomationSettingsForm.tsx b/apps/client/src/features/app-settings/panel/automations-panel/AutomationSettingsForm.tsx index f381e8fe1..5a8c861b3 100644 --- a/apps/client/src/features/app-settings/panel/automations-panel/AutomationSettingsForm.tsx +++ b/apps/client/src/features/app-settings/panel/automations-panel/AutomationSettingsForm.tsx @@ -20,8 +20,12 @@ interface AutomationSettingsProps { oscPortIn: number; } -export default function AutomationSettingsForm(props: AutomationSettingsProps) { - const { enabledAutomations, enabledOscIn, oscPortIn } = props; +export default function AutomationSettingsForm({ + enabledAutomations, + enabledOscIn, + oscPortIn, +}: AutomationSettingsProps) { + 'no memo'; // RHF and react-compiler dont seem to get along const { handleSubmit, diff --git a/apps/client/src/features/app-settings/panel/automations-panel/OntimeActionForm.tsx b/apps/client/src/features/app-settings/panel/automations-panel/OntimeActionForm.tsx index 83aef516c..6bdf47c47 100644 --- a/apps/client/src/features/app-settings/panel/automations-panel/OntimeActionForm.tsx +++ b/apps/client/src/features/app-settings/panel/automations-panel/OntimeActionForm.tsx @@ -23,8 +23,15 @@ interface OntimeActionFormProps { setValue: UseFormSetValue; } -export default function OntimeActionForm(props: PropsWithChildren) { - const { index, register, setValue, rowErrors, value, children, watch } = props; +export default function OntimeActionForm({ + index, + register, + setValue, + rowErrors, + value, + children, + watch, +}: PropsWithChildren) { const [selectedAction, setSelectedAction] = useState(value); const handleSetAction = (value: OntimeActionKey) => { @@ -70,7 +77,7 @@ export default function OntimeActionForm(props: PropsWithChildren('pending'); const [url, setUrl] = useState(serverURL); diff --git a/apps/client/src/features/app-settings/panel/feature-panel/UrlPresetsForm.tsx b/apps/client/src/features/app-settings/panel/feature-panel/UrlPresetsForm.tsx index 7aad743c4..5c8cf50bd 100644 --- a/apps/client/src/features/app-settings/panel/feature-panel/UrlPresetsForm.tsx +++ b/apps/client/src/features/app-settings/panel/feature-panel/UrlPresetsForm.tsx @@ -27,6 +27,7 @@ type FormData = { }; export default function UrlPresetsForm() { + 'use no memo'; // RHF and react-compiler don't seem to get along const { data, status, refetch } = useUrlPresets(); const { control, diff --git a/apps/client/src/features/app-settings/panel/manage-panel/composite/CustomFieldForm.tsx b/apps/client/src/features/app-settings/panel/manage-panel/composite/CustomFieldForm.tsx index d9310aa9f..3cf2eb2b8 100644 --- a/apps/client/src/features/app-settings/panel/manage-panel/composite/CustomFieldForm.tsx +++ b/apps/client/src/features/app-settings/panel/manage-panel/composite/CustomFieldForm.tsx @@ -25,8 +25,14 @@ interface CustomFieldsFormProps { type CustomFieldFormData = CustomField & { key: string }; -export default function CustomFieldForm(props: CustomFieldsFormProps) { - const { onSubmit, onCancel, initialColour, initialLabel, initialKey } = props; +export default function CustomFieldForm({ + onSubmit, + onCancel, + initialColour, + initialLabel, + initialKey, +}: CustomFieldsFormProps) { + 'use no memo'; // RHF and react-compiler don't seem to get along const { data } = useCustomFields(); // we use this to force an update diff --git a/apps/client/src/features/app-settings/panel/manage-panel/sources-panel/import-map/ImportMapForm.tsx b/apps/client/src/features/app-settings/panel/manage-panel/sources-panel/import-map/ImportMapForm.tsx index 3a61905be..f3d04e317 100644 --- a/apps/client/src/features/app-settings/panel/manage-panel/sources-panel/import-map/ImportMapForm.tsx +++ b/apps/client/src/features/app-settings/panel/manage-panel/sources-panel/import-map/ImportMapForm.tsx @@ -24,8 +24,14 @@ interface ImportMapFormProps { onSubmitImport: (importMap: ImportMap) => Promise; } -export default function ImportMapForm(props: ImportMapFormProps) { - const { hasErrors, isSpreadsheet, onCancel, onSubmitExport, onSubmitImport } = props; +export default function ImportMapForm({ + hasErrors, + isSpreadsheet, + onCancel, + onSubmitExport, + onSubmitImport, +}: ImportMapFormProps) { + 'use no memo'; // RHF and react-compiler don't seem to get along const namedImportMap = getPersistedOptions(); const { revoke } = useGoogleSheet(); const { diff --git a/apps/client/src/features/app-settings/panel/project-panel/ProjectCreateForm.tsx b/apps/client/src/features/app-settings/panel/project-panel/ProjectCreateForm.tsx index 776cd68f5..a420371fb 100644 --- a/apps/client/src/features/app-settings/panel/project-panel/ProjectCreateForm.tsx +++ b/apps/client/src/features/app-settings/panel/project-panel/ProjectCreateForm.tsx @@ -22,9 +22,8 @@ type ProjectCreateFormValues = { custom?: { title: string; value: string }[]; }; -export default function ProjectCreateForm(props: ProjectCreateFromProps) { - const { onClose } = props; - +export default function ProjectCreateForm({ onClose }: ProjectCreateFromProps) { + 'use no memo'; // RHF and react-compiler don't seem to get along const [error, setError] = useState(null); const { diff --git a/apps/client/src/features/app-settings/panel/project-panel/ProjectForm.tsx b/apps/client/src/features/app-settings/panel/project-panel/ProjectForm.tsx index 4c5821ea6..b512276af 100644 --- a/apps/client/src/features/app-settings/panel/project-panel/ProjectForm.tsx +++ b/apps/client/src/features/app-settings/panel/project-panel/ProjectForm.tsx @@ -20,6 +20,7 @@ interface ProjectFormProps { } export default function ProjectForm({ action, filename, onSubmit, onCancel }: ProjectFormProps) { + 'use no memo'; // RHF and react-compiler don't seem to get along const { handleSubmit, register, diff --git a/apps/client/src/features/app-settings/panel/project-panel/ProjectMergeForm.tsx b/apps/client/src/features/app-settings/panel/project-panel/ProjectMergeForm.tsx index 66d7cffcb..03437c9fa 100644 --- a/apps/client/src/features/app-settings/panel/project-panel/ProjectMergeForm.tsx +++ b/apps/client/src/features/app-settings/panel/project-panel/ProjectMergeForm.tsx @@ -27,8 +27,8 @@ type ProjectMergeFormValues = { automation: boolean; }; -export default function ProjectMergeForm(props: ProjectMergeFromProps) { - const { onClose, fileName } = props; +export default function ProjectMergeForm({ onClose, fileName }: ProjectMergeFromProps) { + 'use no memo'; // RHF and react-compiler don't seem to get along const [error, setError] = useState(null); const queryClient = useQueryClient(); diff --git a/apps/client/src/features/app-settings/panel/settings-panel/GeneralSettings.tsx b/apps/client/src/features/app-settings/panel/settings-panel/GeneralSettings.tsx index 7ea3b780f..bc4a7ff9a 100644 --- a/apps/client/src/features/app-settings/panel/settings-panel/GeneralSettings.tsx +++ b/apps/client/src/features/app-settings/panel/settings-panel/GeneralSettings.tsx @@ -16,6 +16,7 @@ import * as Panel from '../../panel-utils/PanelUtils'; import GeneralPinInput from './composite/GeneralPinInput'; export default function GeneralSettings() { + 'use no memo'; // RHF and react-compiler don't seem to get along const { data, status, refetch } = useSettings(); const { handleSubmit, diff --git a/apps/client/src/features/app-settings/panel/settings-panel/ProjectData.tsx b/apps/client/src/features/app-settings/panel/settings-panel/ProjectData.tsx index 042f6cd1e..4e19d9191 100644 --- a/apps/client/src/features/app-settings/panel/settings-panel/ProjectData.tsx +++ b/apps/client/src/features/app-settings/panel/settings-panel/ProjectData.tsx @@ -18,6 +18,7 @@ import * as Panel from '../../panel-utils/PanelUtils'; import style from './SettingsPanel.module.scss'; export default function ProjectData() { + 'use no memo'; // RHF and react-compiler don't seem to get along const { data, status, refetch } = useProjectData(); const { diff --git a/apps/client/src/features/app-settings/panel/settings-panel/ViewSettings.tsx b/apps/client/src/features/app-settings/panel/settings-panel/ViewSettings.tsx index 5fced34c4..aa7fab3e5 100644 --- a/apps/client/src/features/app-settings/panel/settings-panel/ViewSettings.tsx +++ b/apps/client/src/features/app-settings/panel/settings-panel/ViewSettings.tsx @@ -18,6 +18,7 @@ import CodeEditorModal from './composite/StyleEditorModal'; const cssOverrideDocsUrl = 'https://docs.getontime.no/features/custom-styling/'; export default function ViewSettings() { + 'use no memo'; // RHF and react-compiler don't seem to get along const { data, isPending, mutateAsync } = useViewSettings(); const [isCodeEditorOpen, codeEditorHandler] = useDisclosure(); diff --git a/apps/client/src/features/app-settings/quick-start/QuickStart.tsx b/apps/client/src/features/app-settings/quick-start/QuickStart.tsx index d6fb7109e..cb48ef1e2 100644 --- a/apps/client/src/features/app-settings/quick-start/QuickStart.tsx +++ b/apps/client/src/features/app-settings/quick-start/QuickStart.tsx @@ -20,6 +20,7 @@ interface QuickStartProps { } export default function QuickStart({ isOpen, onClose }: QuickStartProps) { + 'use no memo'; // RHF and react-compiler don't seem to get along const { defaultWarnTime, defaultDangerTime, setDangerTime, setWarnTime } = useEditorSettings(); const { diff --git a/apps/client/vite.config.js b/apps/client/vite.config.js index 92a7e275b..73ae3980c 100644 --- a/apps/client/vite.config.js +++ b/apps/client/vite.config.js @@ -9,18 +9,11 @@ import { ONTIME_VERSION } from './src/ONTIME_VERSION'; const sentryAuthToken = process.env.SENTRY_AUTH_TOKEN; const isDev = process.env.NODE_ENV === 'local' || process.env.NODE_ENV === 'development'; -const ReactCompilerConfig = { - runtimeModule: '@/mycache', -}; export default defineConfig({ base: './', // Ontime cloud: we use relative paths to allow them to reference a dynamic base set at runtime plugins: [ - react({ - babel: { - plugins: [['babel-plugin-react-compiler', ReactCompilerConfig]], - }, - }), + react(), svgrPlugin(), !isDev && sentryVitePlugin({