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: import error on developer site

Brad Barbinf77738a643f4
diff --git a/apps/developers/app/hooks/useMode.tsx b/apps/developers/app/hooks/useMode.tsx
index 619332f725..580d9fbd9e 100644
--- a/apps/developers/app/hooks/useMode.tsx
+++ b/apps/developers/app/hooks/useMode.tsx
@@ -1,8 +1,8 @@
+import { useRouteData } from "@carbon/remix";
import { useFetchers } from "@remix-run/react";
import type { Mode } from "~/types/validators";
import { modeValidator } from "~/types/validators";
import { path } from "~/utils/path";
-import { useRouteData } from "./useRouteData";
export function useOptimisticMode() {
const fetchers = useFetchers();
diff --git a/apps/developers/app/hooks/useUser.tsx b/apps/developers/app/hooks/useUser.tsx
index 205021bbc4..20efd8b5fa 100644
--- a/apps/developers/app/hooks/useUser.tsx
+++ b/apps/developers/app/hooks/useUser.tsx
@@ -1,5 +1,5 @@
+import { useRouteData } from "@carbon/remix";
import { path } from "~/utils/path";
-import { useRouteData } from "./useRouteData";
type PersonalData = {
id: string;
diff --git a/apps/www/app/hooks/index.ts b/apps/www/app/hooks/index.ts
index 428077e48e..f3e066f7c6 100644
--- a/apps/www/app/hooks/index.ts
+++ b/apps/www/app/hooks/index.ts
@@ -1,5 +1,4 @@
+import { useOptimisticLocation, useRouteData } from "@carbon/remix";
import { useMode } from "./useMode";
-import { useOptimisticLocation } from "./useOptimisticLocation";
-import { useRouteData } from "./useRouteData";
export { useMode, useOptimisticLocation, useRouteData };
diff --git a/apps/www/app/hooks/useMode.tsx b/apps/www/app/hooks/useMode.tsx
index 619332f725..580d9fbd9e 100644
--- a/apps/www/app/hooks/useMode.tsx
+++ b/apps/www/app/hooks/useMode.tsx
@@ -1,8 +1,8 @@
+import { useRouteData } from "@carbon/remix";
import { useFetchers } from "@remix-run/react";
import type { Mode } from "~/types/validators";
import { modeValidator } from "~/types/validators";
import { path } from "~/utils/path";
-import { useRouteData } from "./useRouteData";
export function useOptimisticMode() {
const fetchers = useFetchers();
diff --git a/apps/www/app/hooks/useOptimisticLocation.ts b/apps/www/app/hooks/useOptimisticLocation.ts
deleted file mode 100644
index 84eb784fa9..0000000000
--- a/apps/www/app/hooks/useOptimisticLocation.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-// credit: Matt Aitken at trigger.dev
-import { useLocation, useNavigation } from "@remix-run/react";
-
-export function useOptimisticLocation() {
- const navigation = useNavigation();
- const location = useLocation();
-
- if (navigation.state === "idle" || !navigation.location) {
- return location;
- }
-
- return navigation.location;
-}
diff --git a/apps/www/app/hooks/useRouteData.tsx b/apps/www/app/hooks/useRouteData.tsx
deleted file mode 100644
index 9c6f2bf54a..0000000000
--- a/apps/www/app/hooks/useRouteData.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import { useMatches } from "@remix-run/react";
-import { useMemo } from "react";
-
-export function useRouteData<T>(path: string): T | undefined {
- const matchingRoutes = useMatches();
- const route = useMemo(
- () => matchingRoutes.find((route) => route.pathname === path),
- [matchingRoutes, path]
- );
- return (route?.data as T) || undefined;
-}
diff --git a/apps/www/app/hooks/useUrlParams.tsx b/apps/www/app/hooks/useUrlParams.tsx
deleted file mode 100644
index df815dfcaf..0000000000
--- a/apps/www/app/hooks/useUrlParams.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-import { useSearchParams, useSubmit } from "@remix-run/react";
-import { useCallback } from "react";
-
-export function useUrlParams(): [
- URLSearchParams,
- (
- params: Record<string, string | string[] | number | undefined | null>
- ) => void
-] {
- const submit = useSubmit();
- const [searchParams] = useSearchParams();
-
- const setSearchParams = useCallback(
- (params: Record<string, string | string[] | number | undefined | null>) => {
- Object.entries(params).forEach(([name, value]) => {
- if (value) {
- if (Array.isArray(value)) {
- if (value.length === 0) {
- searchParams.delete(name);
- } else {
- value.forEach((v, i) => {
- if (i === 0) {
- searchParams.set(name, v.toString());
- } else {
- searchParams.append(name, v.toString());
- }
- });
- }
- } else {
- searchParams.set(name, value.toString());
- }
- } else {
- searchParams.delete(name);
- }
- });
-
- submit(searchParams);
- },
- [submit, searchParams]
- );
-
- return [searchParams, setSearchParams];
-}