Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix: onboarding theme step derives the pick from the loader instead of copying it into state

aashub49cd97002a5
diff --git a/apps/erp/app/routes/onboarding+/theme.tsx b/apps/erp/app/routes/onboarding+/theme.tsx
index 8a87825b21..16594c0dd9 100644
--- a/apps/erp/app/routes/onboarding+/theme.tsx
+++ b/apps/erp/app/routes/onboarding+/theme.tsx
@@ -82,14 +82,13 @@ export default function OnboardingTheme() {
const modePreference = useModePreference();
const modeFetcher = useFetcher<typeof modeAction>();
- const [theme, setTheme] = useState<ThemeValue>(initialTheme);
+ const [picked, setPicked] = useState<ThemeValue | null>(null);
+ const theme = picked ?? initialTheme;
const seasonalTheme = useSeasonalTheme();
- const onThemeChange = (t: Theme) => {
+ const applyThemeColors = (t: Theme) => {
// In season the page shows the seasonal theme, whatever is picked.
if (seasonalTheme) return;
- setTheme(t.name);
-
const variables = mode === "dark" ? t.cssVars.dark : t.cssVars.light;
Object.entries(variables).forEach(([key, value]) => {
@@ -101,11 +100,17 @@ export default function OnboardingTheme() {
);
};
+ const onThemeChange = (t: Theme) => {
+ if (seasonalTheme) return;
+ setPicked(t.name);
+ applyThemeColors(t);
+ };
+
// biome-ignore lint/correctness/useExhaustiveDependencies: suppressed due to migration
useEffect(() => {
const t = themes.find((t) => t.name === theme);
if (t) {
- onThemeChange(t);
+ applyThemeColors(t);
}
}, [mode]);
diff --git a/packages/checks/src/conformance/baseline.json b/packages/checks/src/conformance/baseline.json
index 0cab55bb06..ea3cff5905 100644
--- a/packages/checks/src/conformance/baseline.json
+++ b/packages/checks/src/conformance/baseline.json
@@ -583,7 +583,6 @@
"no-state-copy-of-loader-data::apps/erp/app/modules/quality/ui/Documents/QualityDocumentEditor.tsx::const [documentName, setDocumentName] = useState(",
"no-state-copy-of-loader-data::apps/erp/app/modules/resources/ui/Maintenance/MaintenanceDispatchProperties.tsx::const [currentOeeImpact, setCurrentOeeImpact] = useState<string>(",
"no-state-copy-of-loader-data::apps/erp/app/routes/onboarding+/industry.tsx::const [selectedIndustryId, setSelectedIndustryId] = useState<string>(",
- "no-state-copy-of-loader-data::apps/erp/app/routes/onboarding+/theme.tsx::const [theme, setTheme] = useState<ThemeValue>(initialTheme as \"zinc\");",
"no-state-copy-of-loader-data::apps/erp/app/routes/share+/quote.$id.tsx::const [openItems, setOpenItems] = useState<string[]>(() => {",
"no-state-copy-of-loader-data::apps/erp/app/routes/share+/supplier-quote.$id.tsx::const [openItems, setOpenItems] = useState<string[]>(() =>",
"no-state-copy-of-loader-data::apps/erp/app/routes/x+/accounting+/periods.generate.tsx::const [year, setYear] = useState(defaultFiscalYear);",