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.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
fix(erp,mes): load PostHog's scripts into <head> so hydration succeeds (#1907)
BettrCallRaul009be519a27d
diff --git a/apps/erp/app/entry.client.tsx b/apps/erp/app/entry.client.tsxindex 2ab1986865..fc2417c19b 100644--- a/apps/erp/app/entry.client.tsx+++ b/apps/erp/app/entry.client.tsx@@ -35,7 +35,12 @@ if (POSTHOG_PROJECT_PUBLIC_KEY?.startsWith("phc_") && !CONTROLLED_ENVIRONMENT) {api_host: POSTHOG_API_HOST,// LCP, INP and CLS from real sessions: the only way to know which pages are// slow for the people using them.- capture_performance: { web_vitals: true }+ capture_performance: { web_vitals: true },+ // Remote config, web vitals and the recorder load as <script> tags. The+ // default puts them in <body> ahead of React Router's scripts, a node the+ // server never sent, and the whole document fails hydration (#418/#423).+ // React 18 ignores extra nodes at the end of <head>.+ external_scripts_inject_target: "head"});}diff --git a/apps/mes/app/entry.client.tsx b/apps/mes/app/entry.client.tsxindex 3eb1a77c47..7547d9778b 100644--- a/apps/mes/app/entry.client.tsx+++ b/apps/mes/app/entry.client.tsx@@ -32,15 +32,18 @@ ensureLoggingConfigured();//// The key must be a real PostHog project key (`phc_…`), not just non-empty: a// placeholder value (e.g. a masked "****" in a local .env) passes a truthiness-// check, and initializing with it makes posthog-js inject its remote-config-// <script> into the document before hydrateRoot(document) runs — an extra DOM-// node React can't match, so the ENTIRE document fails hydration.+// check and would start analytics with a key PostHog does not know.if (POSTHOG_PROJECT_PUBLIC_KEY?.startsWith("phc_") && !CONTROLLED_ENVIRONMENT) {posthog.init(POSTHOG_PROJECT_PUBLIC_KEY, {api_host: POSTHOG_API_HOST,// LCP, INP and CLS from real sessions: the only way to know which pages are// slow for the people using them.- capture_performance: { web_vitals: true }+ capture_performance: { web_vitals: true },+ // Remote config, web vitals and the recorder load as <script> tags. The+ // default puts them in <body> ahead of React Router's scripts, a node the+ // server never sent, and the whole document fails hydration (#418/#423).+ // React 18 ignores extra nodes at the end of <head>.+ external_scripts_inject_target: "head"});}