perf(ui): defer editor and navigation effects
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import React, { useState, useRef, useCallback, useEffect } from "react";
|
||||
import dynamic from "next/dynamic";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -22,7 +23,6 @@ import { Plus, Trash, ArrowUp, ArrowDown, Loader2, Image as ImageIcon, X } from
|
||||
import Image from 'next/image';
|
||||
import { format, parseISO } from "date-fns";
|
||||
import { DateTimePicker } from "@/components/date-time-picker";
|
||||
import { RichTextEditor } from "@/components/rich-text-editor";
|
||||
import { getErrorMessage } from "@/lib/utils";
|
||||
import {
|
||||
Accordion,
|
||||
@@ -78,6 +78,19 @@ import {
|
||||
SortableQuestion,
|
||||
} from "@/components/admin-form-editor-parts";
|
||||
|
||||
const RichTextEditor = dynamic(
|
||||
() =>
|
||||
import("@/components/rich-text-editor").then(
|
||||
(module) => module.RichTextEditor,
|
||||
),
|
||||
{
|
||||
ssr: false,
|
||||
loading: () => (
|
||||
<div className="h-32 animate-pulse rounded-md border bg-muted/40" />
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
interface Question {
|
||||
id: string;
|
||||
formId: string;
|
||||
|
||||
Reference in New Issue
Block a user