| null;
- markdown?: string;
- fieldChange?: (value: string) => void;
- isInvalid?: boolean;
-}
-
-const Editor = ({
- id,
- editorRef,
- markdown,
- fieldChange,
- isInvalid = false,
- ...props
-}: EditorRefProps & MDXEditorProps) => {
- const { resolvedTheme } = useTheme();
-
- const theme = resolvedTheme === "dark" ? [basicDark] : [];
-
- return (
-
- {
- return (
- editor?.editorType === "codeblock",
- contents: () => ,
- },
- {
- fallback: () => (
- <>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- ),
- },
- ]}
- />
- );
- },
- }),
- ]}
- {...props}
- />
-
- );
-};
-
-export default Editor;
diff --git a/src/components/markdown/markdown-editor.tsx b/src/components/markdown/markdown-editor.tsx
deleted file mode 100644
index 962dc04..0000000
--- a/src/components/markdown/markdown-editor.tsx
+++ /dev/null
@@ -1,49 +0,0 @@
-"use client";
-
-import { ForwardedRef, useCallback, memo } from "react";
-import dynamic from "next/dynamic";
-import { MDXEditorMethods } from "@mdxeditor/editor";
-
-import { useDebounce } from "@/hooks/use-debounce";
-import EditorFallback from "./editor-fallback";
-
-interface MarkdownProps {
- id?: string;
- editorRef: ForwardedRef | null;
- value: string;
- onChange: (value: string) => void;
- isInvalid?: boolean;
-}
-
-const DynamicEditor = dynamic(() => import("./index"), {
- ssr: false,
- loading: () => ,
-});
-
-const MarkdownEditor = memo(
- ({ id, editorRef, value, onChange, isInvalid = false }: MarkdownProps) => {
- const fieldChange = useDebounce(
- useCallback(
- (value: string) => {
- onChange(value);
- },
- [onChange]
- ),
- 300
- );
-
- return (
-
- );
- }
-);
-
-MarkdownEditor.displayName = "MarkdownEditor";
-
-export default MarkdownEditor;
diff --git a/src/components/modules/answers/answer-card.tsx b/src/components/modules/answers/answer-card.tsx
index 2fef173..190520e 100644
--- a/src/components/modules/answers/answer-card.tsx
+++ b/src/components/modules/answers/answer-card.tsx
@@ -7,7 +7,7 @@ import { ReactNode } from "react";
import { cn, getTimeStamp } from "@/lib/utils";
import { Card } from "@/components/ui/card";
import UserAvatar from "@/components/modules/profile/user-avatar";
-import EditorFallback from "@/components/markdown/editor-fallback";
+import EditorFallback from "@/components/editor/markdown/editor-fallback";
import EditDelete from "@/components/shared/edit-delete";
import Votes from "@/components/modules/vote/votes";
import AnswerForm from "./answer-form";
diff --git a/src/components/modules/answers/answer-list.tsx b/src/components/modules/answers/answer-list.tsx
index cce65c6..96b1ce1 100644
--- a/src/components/modules/answers/answer-list.tsx
+++ b/src/components/modules/answers/answer-list.tsx
@@ -14,7 +14,7 @@ import { FilterProvider } from "@/context";
import { NextPagination } from "@/components/ui/dev";
import AnswerCard from "./answer-card";
import ScrollToAnswer from "./scroll-to-answer";
-import MarkdownPreview from "@/components/markdown/markdown-preview";
+import MarkdownPreview from "@/components/editor/markdown/markdown-preview";
interface AnswerListProps {
questionId: string;
diff --git a/src/components/modules/dashboard/nav-user.tsx b/src/components/modules/dashboard/nav-user.tsx
index 5856f30..7fd5fef 100644
--- a/src/components/modules/dashboard/nav-user.tsx
+++ b/src/components/modules/dashboard/nav-user.tsx
@@ -27,7 +27,6 @@ import {
import UserAvatar from "../profile/user-avatar";
import { authClient } from "@/lib/auth-client";
import { Skeleton } from "@/components/ui";
-import { useRouter } from "next/navigation";
import { toast } from "sonner";
export function NavUser() {
@@ -114,8 +113,6 @@ export function NavUser() {
}
function LogoutItem() {
- const router = useRouter();
-
async function handleLogout() {
const { error } = await authClient.signOut();
@@ -123,8 +120,7 @@ function LogoutItem() {
toast.error(error.message || "Something went wrong");
} else {
toast.success("Logged out successfully");
- router.push("/");
- router.refresh();
+ window.location.href = "/";
}
}
diff --git a/src/components/modules/profile/user-nav.tsx b/src/components/modules/profile/user-nav.tsx
index ea0d700..107285c 100644
--- a/src/components/modules/profile/user-nav.tsx
+++ b/src/components/modules/profile/user-nav.tsx
@@ -21,7 +21,6 @@ import UserAvatar from "./user-avatar";
import Link from "next/link";
import { toast } from "sonner";
import { authClient } from "@/lib/auth-client";
-import { useRouter } from "next/navigation";
import { useIsMobile } from "@/hooks/use-mobile";
import { cn } from "@/lib/utils";
@@ -125,8 +124,6 @@ function PendingQuestionsItem() {
}
function LogoutItem() {
- const router = useRouter();
-
async function handleLogout() {
const { error } = await authClient.signOut();
@@ -134,8 +131,8 @@ function LogoutItem() {
toast.error(error.message || "Something went wrong");
} else {
toast.success("Logged out successfully");
- router.push("/");
- router.refresh();
+ // Hard redirect to fully clear Router Cache + stale auth state
+ window.location.href = "/";
}
}
diff --git a/src/components/modules/questions/question-content.tsx b/src/components/modules/questions/question-content.tsx
index b19b354..2120305 100644
--- a/src/components/modules/questions/question-content.tsx
+++ b/src/components/modules/questions/question-content.tsx
@@ -17,7 +17,7 @@ import { SaveQuestion } from "@/components/modules/questions";
import TagCard from "@/components/modules/tags/tag-card";
import EditDelete from "@/components/shared/edit-delete";
import { Separator } from "@/components/ui/separator";
-import MarkdownPreview from "@/components/markdown/markdown-preview";
+import MarkdownPreview from "@/components/editor/markdown/markdown-preview";
import { Metric } from "@/components/shared";
import { QuestionUtilsFallback } from "@/components/modules/questions";
diff --git a/src/hooks/useErrorHandler.ts b/src/hooks/use-error-handler.ts
similarity index 100%
rename from src/hooks/useErrorHandler.ts
rename to src/hooks/use-error-handler.ts