Skip to content

Commit

Permalink
Fix Known Error
Browse files Browse the repository at this point in the history
  • Loading branch information
Osadhi committed Nov 29, 2024
1 parent 2f679ef commit 9f548f3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 30 deletions.
17 changes: 8 additions & 9 deletions app/(main)/(routes)/documents/[documentId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,29 @@
import { Skeleton } from "@/components/ui/skeleton";
import { useMutation, useQuery } from "convex/react";
import { api } from "@/convex/_generated/api";
import { Id } from "@/convex/_generated/dataModel";
import { Toolbar } from "@/components/toolbar";
import { Cover } from "@/components/cover";
import { useMemo } from "react";
import dynamic from "next/dynamic";
import { useRouter } from "next/router";

interface DocumentIdPageProps {
params: { documentId: Id<"documents"> };
}

export default function DocumentIdPage({ params }: Readonly<DocumentIdPageProps>) {
export default function DocumentIdPage() {
const router = useRouter();
const documentId = router.query.documentId;
const Editor = useMemo(
() => dynamic(() => import("@/components/editor"), { ssr: false }),
[]
);

const document = useQuery(api.documents.getById, {
documentId: params.documentId,
});
// @ts-ignore
const document = useQuery(api.documents.getById, {documentId: documentId,});

const update = useMutation(api.documents.update);

const onChange = (content: string) => {
update({ id: params.documentId, content });
// @ts-ignore
update({ id: documentId, content });
};

if (document === undefined) {
Expand Down
22 changes: 8 additions & 14 deletions app/(public)/(routes)/preview/[documentId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,25 @@ import dynamic from "next/dynamic";
import { useMemo } from "react";

import { api } from "@/convex/_generated/api";
import { Id } from "@/convex/_generated/dataModel";
import { Toolbar } from "@/components/toolbar";
import { Cover } from "@/components/cover";
import { Skeleton } from "@/components/ui/skeleton";
import {useRouter} from "next/router";

interface DocumentIdPageProps {
params: {
documentId: Id<"documents">;
};
}

export default function DocumentIdPage({ params }: DocumentIdPageProps) {
export default function DocumentIdPage() {
const router = useRouter();
const documentId = router.query.documentId;
const Editor = useMemo(
() => dynamic(() => import("@/components/editor"), { ssr: false }),
[],
);

const document = useQuery(api.documents.getById, {
documentId: params.documentId,
});
// @ts-ignore
const document = useQuery(api.documents.getById, {documentId: documentId,});
const update = useMutation(api.documents.update);

const onChange = (content: string) => {
update({ id: params.documentId, content });
};
// @ts-ignore
const onChange = (content: string) => {update({ id: documentId, content });};

if (document === undefined) {
return (
Expand Down
16 changes: 9 additions & 7 deletions components/providers/theme-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"use client";
"use client"

import * as React from "react";
import { ThemeProvider as NextThemesProvider } from "next-themes";
import { type ThemeProviderProps } from "next-themes/dist/types";
import * as React from "react"
import { ThemeProvider as NextThemesProvider } from "next-themes"

export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
}
export function ThemeProvider({
children,
...props
}: Readonly<React.ComponentProps<typeof NextThemesProvider>>) {
return <NextThemesProvider {...props}>{children}</NextThemesProvider>
}

0 comments on commit 9f548f3

Please sign in to comment.