refactor: disable react compiler

This commit is contained in:
Carlos Valente
2025-07-13 08:12:02 +02:00
parent e5f8a99bff
commit fd9bf0120c
16 changed files with 49 additions and 24 deletions
@@ -41,8 +41,8 @@ interface AutomationFormProps {
onClose: () => void; onClose: () => void;
} }
export default function AutomationForm(props: AutomationFormProps) { export default function AutomationForm({ automation, onClose }: AutomationFormProps) {
const { automation, onClose } = props; 'no memo'; // RHF and react-compiler dont seem to get along
const isEdit = isAutomation(automation); const isEdit = isAutomation(automation);
const { data } = useCustomFields(); const { data } = useCustomFields();
const { refetch } = useAutomationSettings(); const { refetch } = useAutomationSettings();
@@ -20,8 +20,12 @@ interface AutomationSettingsProps {
oscPortIn: number; oscPortIn: number;
} }
export default function AutomationSettingsForm(props: AutomationSettingsProps) { export default function AutomationSettingsForm({
const { enabledAutomations, enabledOscIn, oscPortIn } = props; enabledAutomations,
enabledOscIn,
oscPortIn,
}: AutomationSettingsProps) {
'no memo'; // RHF and react-compiler dont seem to get along
const { const {
handleSubmit, handleSubmit,
@@ -23,8 +23,15 @@ interface OntimeActionFormProps {
setValue: UseFormSetValue<AutomationDTO>; setValue: UseFormSetValue<AutomationDTO>;
} }
export default function OntimeActionForm(props: PropsWithChildren<OntimeActionFormProps>) { export default function OntimeActionForm({
const { index, register, setValue, rowErrors, value, children, watch } = props; index,
register,
setValue,
rowErrors,
value,
children,
watch,
}: PropsWithChildren<OntimeActionFormProps>) {
const [selectedAction, setSelectedAction] = useState<string>(value); const [selectedAction, setSelectedAction] = useState<string>(value);
const handleSetAction = (value: OntimeActionKey) => { const handleSetAction = (value: OntimeActionKey) => {
@@ -70,7 +77,7 @@ export default function OntimeActionForm(props: PropsWithChildren<OntimeActionFo
New time New time
<Input <Input
{...register(`outputs.${index}.time`, { {...register(`outputs.${index}.time`, {
required: { value: true, message: 'Required field' }, //TODO:(automation set aux) not sure what way around to have the string and where to have the ms value required: { value: true, message: 'Required field' }, //TODO:(automation set aux) not sure what way around to have the string and where to have the ms value
})} })}
fluid fluid
placeholder='eg: 10m5s' placeholder='eg: 10m5s'
@@ -31,6 +31,7 @@ export default function TriggerForm({
onCancel, onCancel,
postSubmit, postSubmit,
}: TriggerFormProps) { }: TriggerFormProps) {
'use no memo'; // RHF and react-compiler don't seem to get along
const { const {
handleSubmit, handleSubmit,
register, register,
@@ -1,3 +1,5 @@
'use no memo'; // RHF and react-compiler don't seem to get along
import { useState } from 'react'; import { useState } from 'react';
import { useForm } from 'react-hook-form'; import { useForm } from 'react-hook-form';
import QRCode from 'react-qr-code'; import QRCode from 'react-qr-code';
@@ -32,6 +34,7 @@ interface GenerateLinkFormOptions {
type GenerateLinkState = 'pending' | 'loading' | 'success' | 'error'; type GenerateLinkState = 'pending' | 'loading' | 'success' | 'error';
export default function GenerateLinkForm({ hostOptions, pathOptions, isLockedToView }: GenerateLinkFormProps) { export default function GenerateLinkForm({ hostOptions, pathOptions, isLockedToView }: GenerateLinkFormProps) {
'use no memo'; // RHF and react-compiler don't seem to get along
const [formState, setFormState] = useState<GenerateLinkState>('pending'); const [formState, setFormState] = useState<GenerateLinkState>('pending');
const [url, setUrl] = useState(serverURL); const [url, setUrl] = useState(serverURL);
@@ -27,6 +27,7 @@ type FormData = {
}; };
export default function UrlPresetsForm() { export default function UrlPresetsForm() {
'use no memo'; // RHF and react-compiler don't seem to get along
const { data, status, refetch } = useUrlPresets(); const { data, status, refetch } = useUrlPresets();
const { const {
control, control,
@@ -25,8 +25,14 @@ interface CustomFieldsFormProps {
type CustomFieldFormData = CustomField & { key: string }; type CustomFieldFormData = CustomField & { key: string };
export default function CustomFieldForm(props: CustomFieldsFormProps) { export default function CustomFieldForm({
const { onSubmit, onCancel, initialColour, initialLabel, initialKey } = props; onSubmit,
onCancel,
initialColour,
initialLabel,
initialKey,
}: CustomFieldsFormProps) {
'use no memo'; // RHF and react-compiler don't seem to get along
const { data } = useCustomFields(); const { data } = useCustomFields();
// we use this to force an update // we use this to force an update
@@ -24,8 +24,14 @@ interface ImportMapFormProps {
onSubmitImport: (importMap: ImportMap) => Promise<void>; onSubmitImport: (importMap: ImportMap) => Promise<void>;
} }
export default function ImportMapForm(props: ImportMapFormProps) { export default function ImportMapForm({
const { hasErrors, isSpreadsheet, onCancel, onSubmitExport, onSubmitImport } = props; hasErrors,
isSpreadsheet,
onCancel,
onSubmitExport,
onSubmitImport,
}: ImportMapFormProps) {
'use no memo'; // RHF and react-compiler don't seem to get along
const namedImportMap = getPersistedOptions(); const namedImportMap = getPersistedOptions();
const { revoke } = useGoogleSheet(); const { revoke } = useGoogleSheet();
const { const {
@@ -22,9 +22,8 @@ type ProjectCreateFormValues = {
custom?: { title: string; value: string }[]; custom?: { title: string; value: string }[];
}; };
export default function ProjectCreateForm(props: ProjectCreateFromProps) { export default function ProjectCreateForm({ onClose }: ProjectCreateFromProps) {
const { onClose } = props; 'use no memo'; // RHF and react-compiler don't seem to get along
const [error, setError] = useState<string | null>(null); const [error, setError] = useState<string | null>(null);
const { const {
@@ -20,6 +20,7 @@ interface ProjectFormProps {
} }
export default function ProjectForm({ action, filename, onSubmit, onCancel }: ProjectFormProps) { export default function ProjectForm({ action, filename, onSubmit, onCancel }: ProjectFormProps) {
'use no memo'; // RHF and react-compiler don't seem to get along
const { const {
handleSubmit, handleSubmit,
register, register,
@@ -27,8 +27,8 @@ type ProjectMergeFormValues = {
automation: boolean; automation: boolean;
}; };
export default function ProjectMergeForm(props: ProjectMergeFromProps) { export default function ProjectMergeForm({ onClose, fileName }: ProjectMergeFromProps) {
const { onClose, fileName } = props; 'use no memo'; // RHF and react-compiler don't seem to get along
const [error, setError] = useState<string | null>(null); const [error, setError] = useState<string | null>(null);
const queryClient = useQueryClient(); const queryClient = useQueryClient();
@@ -16,6 +16,7 @@ import * as Panel from '../../panel-utils/PanelUtils';
import GeneralPinInput from './composite/GeneralPinInput'; import GeneralPinInput from './composite/GeneralPinInput';
export default function GeneralSettings() { export default function GeneralSettings() {
'use no memo'; // RHF and react-compiler don't seem to get along
const { data, status, refetch } = useSettings(); const { data, status, refetch } = useSettings();
const { const {
handleSubmit, handleSubmit,
@@ -18,6 +18,7 @@ import * as Panel from '../../panel-utils/PanelUtils';
import style from './SettingsPanel.module.scss'; import style from './SettingsPanel.module.scss';
export default function ProjectData() { export default function ProjectData() {
'use no memo'; // RHF and react-compiler don't seem to get along
const { data, status, refetch } = useProjectData(); const { data, status, refetch } = useProjectData();
const { const {
@@ -18,6 +18,7 @@ import CodeEditorModal from './composite/StyleEditorModal';
const cssOverrideDocsUrl = 'https://docs.getontime.no/features/custom-styling/'; const cssOverrideDocsUrl = 'https://docs.getontime.no/features/custom-styling/';
export default function ViewSettings() { export default function ViewSettings() {
'use no memo'; // RHF and react-compiler don't seem to get along
const { data, isPending, mutateAsync } = useViewSettings(); const { data, isPending, mutateAsync } = useViewSettings();
const [isCodeEditorOpen, codeEditorHandler] = useDisclosure(); const [isCodeEditorOpen, codeEditorHandler] = useDisclosure();
@@ -20,6 +20,7 @@ interface QuickStartProps {
} }
export default function QuickStart({ isOpen, onClose }: 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 { defaultWarnTime, defaultDangerTime, setDangerTime, setWarnTime } = useEditorSettings();
const { const {
+1 -8
View File
@@ -9,18 +9,11 @@ import { ONTIME_VERSION } from './src/ONTIME_VERSION';
const sentryAuthToken = process.env.SENTRY_AUTH_TOKEN; const sentryAuthToken = process.env.SENTRY_AUTH_TOKEN;
const isDev = process.env.NODE_ENV === 'local' || process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'local' || process.env.NODE_ENV === 'development';
const ReactCompilerConfig = {
runtimeModule: '@/mycache',
};
export default defineConfig({ export default defineConfig({
base: './', // Ontime cloud: we use relative paths to allow them to reference a dynamic base set at runtime base: './', // Ontime cloud: we use relative paths to allow them to reference a dynamic base set at runtime
plugins: [ plugins: [
react({ react(),
babel: {
plugins: [['babel-plugin-react-compiler', ReactCompilerConfig]],
},
}),
svgrPlugin(), svgrPlugin(),
!isDev && !isDev &&
sentryVitePlugin({ sentryVitePlugin({